Просмотр исходного кода

Merge branch 'dev' of ssh://10.10.100.21/source/saas-platform into dev

zhuth 7 лет назад
Родитель
Сommit
1eb213ae0f
63 измененных файлов с 3096 добавлено и 244 удалено
  1. 6 1
      applications/commons/commons-api/src/main/java/com/usoftchina/saas/commons/api/MessageLogService.java
  2. 5 0
      applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/exception/BizExceptionCode.java
  3. 5 1
      applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/po/Status.java
  4. 20 0
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/controller/MessageLogController.java
  5. 3 0
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/MessageLogService.java
  6. 5 0
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/impl/MessageLogServiceImpl.java
  7. 1 1
      applications/document/document-api/src/main/java/com/usoftchina/saas/document/api/ProductApi.java
  8. 2 2
      applications/document/document-api/src/main/java/com/usoftchina/saas/document/api/WarehouseApi.java
  9. 128 0
      applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/VendorList.java
  10. 41 31
      applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Vendorcontact.java
  11. 13 2
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/DocumentApplication.java
  12. 5 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/CustomerkindController.java
  13. 28 2
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/ProductController.java
  14. 69 2
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/VendorController.java
  15. 4 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/CustomerkindMapper.java
  16. 2 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/ProductMapper.java
  17. 3 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/VendorMapper.java
  18. 10 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/VendorcontactMapper.java
  19. 4 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/CustomerkindService.java
  20. 30 3
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/ProductService.java
  21. 51 2
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/VendorService.java
  22. 23 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/AddressServiceImpl.java
  23. 35 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/CustomerkindServiceImpl.java
  24. 21 2
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/FundinouttypeServiceImpl.java
  25. 91 4
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProductServiceImpl.java
  26. 7 6
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProductbrandServiceImpl.java
  27. 24 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProducttypeServiceImpl.java
  28. 25 2
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProductunitServiceImpl.java
  29. 144 2
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/VendorServiceImpl.java
  30. 23 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/VendorkindServiceImpl.java
  31. 25 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/WarehouseServiceImpl.java
  32. 3 0
      applications/document/document-server/src/main/resources/mapper/CustomerkindMapper.xml
  33. 49 0
      applications/document/document-server/src/main/resources/mapper/VendorMapper.xml
  34. 219 49
      applications/document/document-server/src/main/resources/mapper/VendorcontactMapper.xml
  35. 7 6
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/controller/PurchaseController.java
  36. 3 2
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/mapper/PurchaseMapper.java
  37. 2 1
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/ProdInOutService.java
  38. 3 2
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/ProdInOutServiceImpl.java
  39. 6 4
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/PurchaseServiceImpl.java
  40. 6 6
      applications/purchase/purchase-server/src/main/resources/mapper/PurchaseMapper.xml
  41. 9 1
      applications/sale/sale-dto/pom.xml
  42. 91 0
      applications/sale/sale-dto/src/main/java/com/usoftchina/saas/sale/dto/ProdIODetailDTO.java
  43. 73 0
      applications/sale/sale-dto/src/main/java/com/usoftchina/saas/sale/dto/ProdInOutDTO.java
  44. 18 0
      applications/sale/sale-dto/src/main/java/com/usoftchina/saas/sale/dto/ProdInOutFormDTO.java
  45. 140 0
      applications/sale/sale-dto/src/main/java/com/usoftchina/saas/sale/dto/ProdInOutListDTO.java
  46. 28 0
      applications/sale/sale-dto/src/main/java/com/usoftchina/saas/sale/dto/ProdInOutReqDTO.java
  47. 1 2
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/SaleApplication.java
  48. 161 0
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/controller/ProdInOutController.java
  49. 4 4
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/controller/SaleController.java
  50. 18 7
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/ProdIODetailMapper.java
  51. 20 0
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/ProdInOutListMapper.java
  52. 32 1
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/ProdInOutMapper.java
  53. 2 2
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/SaleMapper.java
  54. 76 0
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/ProdInOutService.java
  55. 584 0
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/ProdInOutServiceImpl.java
  56. 23 21
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/SaleServiceImpl.java
  57. 297 25
      applications/sale/sale-server/src/main/resources/mapper/ProdIODetailMapper.xml
  58. 100 0
      applications/sale/sale-server/src/main/resources/mapper/ProdInOutListMapper.xml
  59. 252 5
      applications/sale/sale-server/src/main/resources/mapper/ProdInOutMapper.xml
  60. 3 3
      applications/sale/sale-server/src/main/resources/mapper/SaleMapper.xml
  61. 1 1
      applications/storage/storage-dto/src/main/java/com/usoftchina/saas/storage/po/ProdIODetail.java
  62. 9 30
      frontend/saas-web/app/view/purchase/purchase/FormPanel.js
  63. 3 3
      frontend/saas-web/app/view/purchase/purchase/FormPanelController.js

+ 6 - 1
applications/commons/commons-api/src/main/java/com/usoftchina/saas/commons/api/MessageLogService.java

@@ -1,9 +1,11 @@
 package com.usoftchina.saas.commons.api;
 
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.commons.po.Operation;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.context.request.async.DeferredResult;
 
 /**
@@ -35,6 +37,9 @@ public interface MessageLogService {
     @RequestMapping("/messagelog/close")
     public String close(@RequestBody DocBaseDTO baseDTO);
 
-    @RequestMapping("//messagelog/open")
+    @RequestMapping("/messagelog/open")
     public String open(@RequestBody DocBaseDTO baseDTO);
+
+    @RequestMapping("/messagelog/customizeLog")
+    public String customizeLog(@RequestBody DocBaseDTO baseDTO, @RequestParam("operation") Operation operation);
 }

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

@@ -22,6 +22,9 @@ public enum BizExceptionCode implements BaseExceptionCode {
     CODE_EXISTS(79200, "单据编号已存在"),
     BIZ_CLOSE(79301, "只能关闭已审核的单据"),
     BIZ_OPEN(79002, "只能打开已关闭的单据"),
+    NO_DATA(79998, "未找到数据"),
+    ILLEGAL_ID(79999, "id不正确"),
+
 
     //采购
 
@@ -30,6 +33,8 @@ public enum BizExceptionCode implements BaseExceptionCode {
     SALE_CLOSE(72001, "单据已关闭,无法进行操作"),
     SALE_YQTYBEYONDQTY(72001, "明细行已转数量大于数量"),
     SALE_NULL_BILL(72002, "单据不存在或者明细为空"),
+    SALEOUT_ALL_TURNIN(72003, "该销售出货单已全部转退货,无法转销售退货单"),
+    SALEOUT_POSTSTATUS_ERROR(72004,"单据状态异常,无法反审核"),
     //资金
 
     //库存

+ 5 - 1
applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/po/Status.java

@@ -44,8 +44,12 @@ public enum Status {
     /**
      * 未出库
      */
-    UNTURNOUT("未出库")
+    UNTURNOUT("未出库"),
 
+    /**
+     * 开启
+     */
+    OPEN("开启")
 
     ;
     private String display;

+ 20 - 0
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/controller/MessageLogController.java

@@ -1,10 +1,13 @@
 package com.usoftchina.saas.commons.controller;
 
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.commons.po.Operation;
 import com.usoftchina.saas.commons.service.MessageLogService;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.context.request.async.DeferredResult;
 
@@ -92,4 +95,21 @@ public class MessageLogController {
                 .whenCompleteAsync((result, throwable) -> deferredResult.setResult(result));
         return deferredResult;
     }
+
+    /**
+    * @Description 自定义的Log
+    * @Param: [baseDTO]
+    * @return: org.springframework.web.context.request.async.DeferredResult<java.lang.String>
+    * @Author: guq
+    * @Date: 2018/10/25
+    */
+    @RequestMapping("/customizeLog")
+    public DeferredResult<String> customizeLog(@RequestBody DocBaseDTO baseDTO, @RequestParam Operation operation) {
+        // Create the deferredResult and initiate a callback object, task, with it
+        DeferredResult<String> deferredResult = new DeferredResult<>();
+        System.out.println(operation.getTitle() + "  : " + operation.getResult());
+        CompletableFuture.supplyAsync(() -> messageLogService.customizeLog(baseDTO, operation))
+                .whenCompleteAsync((result, throwable) -> deferredResult.setResult(result));
+        return deferredResult;
+    }
 }

+ 3 - 0
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/MessageLogService.java

@@ -4,6 +4,7 @@ import com.usoftchina.saas.base.service.CommonBaseService;
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.commons.mapper.MessagelogMapper;
 import com.usoftchina.saas.commons.po.Messagelog;
+import com.usoftchina.saas.commons.po.Operation;
 
 public interface MessageLogService extends CommonBaseService<MessagelogMapper, Messagelog>{
     String save(DocBaseDTO baseDTO);
@@ -21,4 +22,6 @@ public interface MessageLogService extends CommonBaseService<MessagelogMapper, M
     String close(DocBaseDTO baseDTO);
 
     String open(DocBaseDTO baseDTO);
+
+    String customizeLog(DocBaseDTO baseDTO, Operation operation);
 }

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

@@ -67,6 +67,11 @@ public class MessageLogServiceImpl extends CommonBaseServiceImpl<MessagelogMappe
         return log(Operation.OPEN, baseDTO);
     }
 
+    @Override
+    public String customizeLog(DocBaseDTO baseDTO, Operation operation) {
+        return log(operation, baseDTO);
+    }
+
     private String log(Operation operation, DocBaseDTO baseDTO) {
         String language = "zh_CN";
         Messagelog msg = new Messagelog();

+ 1 - 1
applications/document/document-api/src/main/java/com/usoftchina/saas/document/api/ProductApi.java

@@ -29,6 +29,6 @@ public interface ProductApi {
     * @Author: guq
     * @Date: 2018/10/16
     */
-    @RequestMapping("/api/document/product/updateLatestPurchasePrice")
+    @RequestMapping("/product/updateLatestPurchasePrice")
     public void updateLatestPurchasePrice(@RequestParam(value = "id") Long pu_id);
 }

+ 2 - 2
applications/document/document-api/src/main/java/com/usoftchina/saas/document/api/WarehouseApi.java

@@ -9,10 +9,10 @@ import java.util.Map;
 @FeignClient(name = "document-server")
 public interface WarehouseApi {
 
-    @GetMapping("/api/document/warehouse/post")
+    @GetMapping("/warehouse/post")
     public Result post(Map<String, Object> param);
 
-    @GetMapping("/api/document/warehouse/unPost")
+    @GetMapping("/warehouse/unPost")
     public Result unPost(Map<String, Object> param);
 
 }

+ 128 - 0
applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/VendorList.java

@@ -0,0 +1,128 @@
+package com.usoftchina.saas.document.entities;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+public class VendorList implements Serializable {
+
+    /* 主表字段 */
+    private Long ve_id;
+    /**
+     * 供应商编号
+     */
+    private String ve_code;
+    /**
+     * 供应商名称
+     */
+    private String ve_name;
+    /**
+     * 供应商UU
+     */
+    private String ve_uu;
+    /**
+     * 供应商类型
+     */
+    private String ve_type;
+    /**
+     * 期初日期
+     */
+    private Date ve_begindate;
+    /**
+     * 期初应付
+     */
+    private long ve_beginapamount;
+    /**
+     * 期初预付
+     */
+    private long ve_beginprepayamount;
+    /**
+     * 承付天数
+     */
+    private long ve_promisedays;
+    /**
+     * 税率
+     */
+    private double ve_taxrate;
+    /**
+     * 纳税人识别号
+     */
+    private String ve_nsrzh;
+    /**
+     * 银行账号
+     */
+    private String ve_bankaccount;
+    /**
+     * 银行行号
+     */
+    private String ve_bankcode;
+    /**
+     * 状态   defualt "启用"
+     */
+    private String ve_status;
+    /**
+     * 状态码
+     */
+    private String ve_statuscode;
+    /**
+     * 录入人ID
+     */
+    private long ve_recordid;
+    /**
+     * 录入人
+     */
+    private String ve_recordname;
+    /**
+     * 建立日期
+     */
+    private Date ve_initdate;
+    /**
+     * 自定义字段
+     */
+    private String ve_text1;
+    /**
+     * 自定义字段
+     */
+    private String ve_text2;
+    /**
+     * 自定义字段
+     */
+    private String ve_text3;
+    /**
+     * 自定义字段
+     */
+    private String ve_text4;
+    /**
+     * 自定义字段
+     */
+    private String ve_text5;
+
+    /* 从表字段 */
+
+    private Integer vc_veid;
+
+    private Integer vc_detno;
+
+    private String vc_name;
+
+    private Integer vc_tel;
+
+    private String vc_qq;
+
+    private String vc_email;
+
+    private String vc_text1;
+
+    private String vc_text2;
+
+    private String vc_text3;
+
+    private String vc_text4;
+
+    private String vc_text5;
+
+    private String vc_default;
+
+}

+ 41 - 31
applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Vendorcontact.java

@@ -6,7 +6,7 @@ import java.io.Serializable;
 import java.util.Date;
 
 public class Vendorcontact extends CommonBaseEntity implements Serializable {
-    private Integer vc_veid;
+    private Long vc_veid;
 
     private Integer vc_detno;
 
@@ -18,21 +18,23 @@ public class Vendorcontact extends CommonBaseEntity implements Serializable {
 
     private String vc_email;
 
-    private String ve_text1;
+    private String vc_text1;
 
-    private String ve_text2;
+    private String vc_text2;
 
-    private String ve_text3;
+    private String vc_text3;
 
-    private String ve_text4;
+    private String vc_text4;
 
-    private String ve_text5;
+    private String vc_text5;
 
-    public Integer getVc_veid() {
+    private String vc_default;
+
+    public Long getVc_veid() {
         return vc_veid;
     }
 
-    public void setVc_veid(Integer vc_veid) {
+    public void setVc_veid(Long vc_veid) {
         this.vc_veid = vc_veid;
     }
 
@@ -49,7 +51,7 @@ public class Vendorcontact extends CommonBaseEntity implements Serializable {
     }
 
     public void setVc_name(String vc_name) {
-        this.vc_name = vc_name == null ? null : vc_name.trim();
+        this.vc_name = vc_name;
     }
 
     public Integer getVc_tel() {
@@ -65,7 +67,7 @@ public class Vendorcontact extends CommonBaseEntity implements Serializable {
     }
 
     public void setVc_qq(String vc_qq) {
-        this.vc_qq = vc_qq == null ? null : vc_qq.trim();
+        this.vc_qq = vc_qq;
     }
 
     public String getVc_email() {
@@ -73,46 +75,54 @@ public class Vendorcontact extends CommonBaseEntity implements Serializable {
     }
 
     public void setVc_email(String vc_email) {
-        this.vc_email = vc_email == null ? null : vc_email.trim();
+        this.vc_email = vc_email;
+    }
+
+    public String getVc_text1() {
+        return vc_text1;
+    }
+
+    public void setVc_text1(String vc_text1) {
+        this.vc_text1 = vc_text1;
     }
 
-    public String getVe_text1() {
-        return ve_text1;
+    public String getVc_text2() {
+        return vc_text2;
     }
 
-    public void setVe_text1(String ve_text1) {
-        this.ve_text1 = ve_text1 == null ? null : ve_text1.trim();
+    public void setVc_text2(String vc_text2) {
+        this.vc_text2 = vc_text2;
     }
 
-    public String getVe_text2() {
-        return ve_text2;
+    public String getVc_text3() {
+        return vc_text3;
     }
 
-    public void setVe_text2(String ve_text2) {
-        this.ve_text2 = ve_text2 == null ? null : ve_text2.trim();
+    public void setVc_text3(String vc_text3) {
+        this.vc_text3 = vc_text3;
     }
 
-    public String getVe_text3() {
-        return ve_text3;
+    public String getVc_text4() {
+        return vc_text4;
     }
 
-    public void setVe_text3(String ve_text3) {
-        this.ve_text3 = ve_text3 == null ? null : ve_text3.trim();
+    public void setVc_text4(String vc_text4) {
+        this.vc_text4 = vc_text4;
     }
 
-    public String getVe_text4() {
-        return ve_text4;
+    public String getVc_text5() {
+        return vc_text5;
     }
 
-    public void setVe_text4(String ve_text4) {
-        this.ve_text4 = ve_text4 == null ? null : ve_text4.trim();
+    public void setVc_text5(String vc_text5) {
+        this.vc_text5 = vc_text5;
     }
 
-    public String getVe_text5() {
-        return ve_text5;
+    public String getVc_default() {
+        return vc_default;
     }
 
-    public void setVe_text5(String ve_text5) {
-        this.ve_text5 = ve_text5 == null ? null : ve_text5.trim();
+    public void setVc_default(String vc_default) {
+        this.vc_default = vc_default;
     }
 }

+ 13 - 2
applications/document/document-server/src/main/java/com/usoftchina/saas/document/DocumentApplication.java

@@ -6,17 +6,28 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
 import org.springframework.cloud.openfeign.EnableFeignClients;
 import org.springframework.transaction.annotation.EnableTransactionManagement;
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
 
 @SpringBootApplication
 @EnableEurekaClient
 //@EnableAuthClient
 @EnableTransactionManagement
-@EnableFeignClients
+@EnableFeignClients("com.usoftchina.saas")
 @MapperScan("com.usoftchina.saas.document.mapper")
-public class DocumentApplication {
+public class DocumentApplication extends WebMvcConfigurerAdapter {
 
     public static void main(String[] args) {
         SpringApplication.run(DocumentApplication.class);
     }
 
+    @Override
+    public void addCorsMappings(CorsRegistry registry) {
+        registry.addMapping("/**")
+                .allowCredentials(true)
+                .allowedHeaders("*")
+                .allowedOrigins("*")
+                .allowedMethods("*");
+    }
+
 }

+ 5 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/CustomerkindController.java

@@ -34,4 +34,9 @@ public class CustomerkindController {
         return Result.success(customerkindList);
     }
 
+    @GetMapping("/getCombo")
+    public Result getCombo(){
+        List<Customerkind> customerkindList = customerkindService.getCombo();
+        return Result.success(customerkindList);
+    }
 }

+ 28 - 2
applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/ProductController.java

@@ -6,10 +6,12 @@ import com.usoftchina.saas.base.Result;
 
 import com.usoftchina.saas.commons.dto.ComboDTO;
 import com.usoftchina.saas.commons.dto.DocReqDTO;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
 import com.usoftchina.saas.document.dto.ProductDTO;
 import com.usoftchina.saas.document.entities.Product;
 import com.usoftchina.saas.document.service.ProductService;
 import com.usoftchina.saas.page.PageRequest;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -22,9 +24,15 @@ public class ProductController {
     @Autowired
     private ProductService productService;
 
+    /**
+     * 通过条件查找物料
+     * @param page      分页对象
+     * @param listReqDTO    条件对象
+     * @return  Result<List<ProductDTO>>
+     */
     @RequestMapping("/getProductsByCondition")
-    public Result<List<ProductDTO>> getProductsByCondition(PageRequest page, DocReqDTO docReqDTO){
-        PageInfo<ProductDTO> productList = productService.getProductsByCondition(page, docReqDTO);
+    public Result<List<ProductDTO>> getProductsByCondition(PageRequest page, ListReqDTO listReqDTO){
+        PageInfo<ProductDTO> productList = productService.getProductsByCondition(page, listReqDTO);
         return Result.success(productList);
     }
 
@@ -44,4 +52,22 @@ public class ProductController {
         return productService.getProductsByPK(id);
     }
 
+    @PostMapping("/save")
+    public Result save(@RequestBody Product product){
+        productService.save(product);
+        return Result.success();
+    }
+
+    @PostMapping("/delete/{id}")
+    public Result delete(@PathVariable("id") Long id){
+        productService.removeByPrimaryKey(id);
+        return Result.success();
+    }
+
+    @PostMapping("/close/{id}")
+    public Result close(@PathVariable("id") Long id){
+        productService.close(id);
+        return Result.success();
+    }
+
 }

+ 69 - 2
applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/VendorController.java

@@ -3,10 +3,12 @@ package com.usoftchina.saas.document.controller;
 import com.github.pagehelper.PageInfo;
 import com.usoftchina.saas.base.Result;
 
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.commons.dto.DocReqDTO;
 import com.usoftchina.saas.commons.dto.ListReqDTO;
 import com.usoftchina.saas.document.dto.VendorDTO;
 import com.usoftchina.saas.document.dto.VendorListDTO;
+import com.usoftchina.saas.document.entities.VendorList;
 import com.usoftchina.saas.document.service.VendorService;
 import com.usoftchina.saas.page.PageRequest;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -21,16 +23,81 @@ public class VendorController {
     @Autowired
     private VendorService vendorService;
 
+    /**
+     * 获取供应商信息
+     * @param page
+     * @param listReqDTO
+     * @return
+     */
     @GetMapping("/getVendorsByCondition")
     public Result<List<VendorDTO>> getVendorsByCondition(PageRequest page, ListReqDTO listReqDTO){
         PageInfo<VendorDTO> vendorList = vendorService.getVendorsByCondition(page, listReqDTO);
         return Result.success(vendorList);
     }
 
+    /**
+     * 通过供应商ID查找  供应商主从表数据
+     * @param id
+     * @return
+     */
     @GetMapping("/getListById/{id}")
     public Result<VendorListDTO> getDataById(@PathVariable("id") Long id){
-//        List<> vendorService.getListById(id);
-        return null;
+        VendorListDTO vendorListDTO = vendorService.getListById(id);
+        return Result.success(vendorListDTO);
+    }
+
+    /**
+     * 获取 供应商列表数据,包含供应商主表、从表数据
+     * @param listReqDTO
+     * @return
+     */
+    @GetMapping("/getListDataByCondition")
+    public Result<List<VendorList>> getListDataByCondition(ListReqDTO listReqDTO){
+        return Result.success(vendorService.getListDataByCondition(listReqDTO));
+    }
+
+    /**
+     * 保存供应商资料, 主从表数据
+     * @param vendorListDTO
+     * @return
+     */
+    @PostMapping("/save")
+    public Result saveFormData(@RequestBody VendorListDTO vendorListDTO){
+        DocBaseDTO docBaseDTO = vendorService.saveFormData(vendorListDTO);
+        return Result.success(docBaseDTO);
+    }
+
+    /**
+     * 删除
+     * @param id
+     * @return
+     */
+    @PostMapping("/delete/{id}")
+    public Result delete(@PathVariable("id") Long id){
+        vendorService.deleteById(id);
+        return Result.success();
+    }
+
+    /**
+     * 关闭
+     * @param id
+     * @return
+     */
+    @PostMapping("/close/{id}")
+    public Result close(@PathVariable("id") Long id){
+        vendorService.close(id);
+        return Result.success();
+    }
+
+    /**
+     * 开启
+     * @param id
+     * @return
+     */
+    @PostMapping("/open/{id}")
+    public Result open(@PathVariable("id") Long id){
+        vendorService.open(id);
+        return Result.success();
     }
 
 }

+ 4 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/CustomerkindMapper.java

@@ -3,6 +3,8 @@ package com.usoftchina.saas.document.mapper;
 import com.usoftchina.saas.base.mapper.CommonBaseMapper;
 import com.usoftchina.saas.document.entities.Customerkind;
 
+import java.util.List;
+
 public interface CustomerkindMapper extends CommonBaseMapper<Customerkind> {
     int deleteByPrimaryKey(Long id);
 
@@ -15,4 +17,6 @@ public interface CustomerkindMapper extends CommonBaseMapper<Customerkind> {
     int updateByPrimaryKeySelective(Customerkind record);
 
     int updateByPrimaryKey(Customerkind record);
+
+    List<Customerkind> getCombo();
 }

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

@@ -6,12 +6,13 @@ import com.usoftchina.saas.commons.dto.ComboDTO;
 import com.usoftchina.saas.commons.dto.DocReqDTO;
 import com.usoftchina.saas.document.dto.ProductDTO;
 import com.usoftchina.saas.document.entities.Product;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
 public interface ProductMapper extends CommonBaseMapper<Product> {
 
-    List<ProductDTO> getProductsByCondition(DocReqDTO docReqDTO);
+    List<ProductDTO> getProductsByCondition(@Param("condition") String condition, @Param("companyId") Long companyId);
     List<ComboDTO> getProdUnit();
     void updateLatestPurchasePrice(Long pu_id);
 

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

@@ -4,7 +4,9 @@ import com.usoftchina.saas.base.mapper.CommonBaseMapper;
 
 
 import com.usoftchina.saas.document.dto.VendorDTO;
+import com.usoftchina.saas.document.dto.VendorListDTO;
 import com.usoftchina.saas.document.entities.Vendor;
+import com.usoftchina.saas.document.entities.VendorList;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -13,4 +15,5 @@ public interface VendorMapper extends CommonBaseMapper<Vendor> {
 
     List<VendorDTO> getVendorsByCondition(@Param("condition") String condition, @Param("companyId") Long companyId);
 
+    List<VendorList> getListDataByCondition(@Param("condition") String condition, @Param("companyId") Long companyId);
 }

+ 10 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/VendorcontactMapper.java

@@ -3,6 +3,8 @@ package com.usoftchina.saas.document.mapper;
 import com.usoftchina.saas.base.mapper.CommonBaseMapper;
 import com.usoftchina.saas.document.entities.Vendorcontact;
 
+import java.util.List;
+
 public interface VendorcontactMapper extends CommonBaseMapper<Vendorcontact> {
     int deleteByPrimaryKey(Long vc_id);
 
@@ -15,4 +17,12 @@ public interface VendorcontactMapper extends CommonBaseMapper<Vendorcontact> {
     int updateByPrimaryKeySelective(Vendorcontact record);
 
     int updateByPrimaryKey(Vendorcontact record);
+
+    List<Vendorcontact> selectByFK(Long id);
+
+    void batchInsert(List<Vendorcontact> vendorcontactList);
+
+    void batchUpdate(List<Vendorcontact> vendorcontactList);
+
+    void deleteByFK(Long id);
 }

+ 4 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/CustomerkindService.java

@@ -4,6 +4,10 @@ import com.usoftchina.saas.base.service.CommonBaseService;
 import com.usoftchina.saas.document.entities.Customerkind;
 import com.usoftchina.saas.document.mapper.CustomerkindMapper;
 
+import java.util.List;
+
 public interface CustomerkindService extends CommonBaseService<CustomerkindMapper, Customerkind> {
 
+    List<Customerkind> getCombo();
+
 }

+ 30 - 3
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/ProductService.java

@@ -5,7 +5,8 @@ import com.usoftchina.saas.base.service.CommonBaseService;
 
 
 import com.usoftchina.saas.commons.dto.ComboDTO;
-import com.usoftchina.saas.commons.dto.DocReqDTO;
+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.entities.Product;
 import com.usoftchina.saas.document.mapper.ProductMapper;
@@ -16,12 +17,38 @@ import java.util.List;
 
 public interface ProductService extends CommonBaseService<ProductMapper, Product> {
 
-
-    PageInfo<ProductDTO> getProductsByCondition(PageRequest page, DocReqDTO docReqDTO);
+    /**
+     * 获取物料
+     * @param page      分页对象
+     * @param listReqDTO    条件对象
+     * @return  PageInfo<ProductDTO>
+     */
+    PageInfo<ProductDTO> getProductsByCondition(PageRequest page, ListReqDTO listReqDTO);
 
     List<ComboDTO> getProdUnit();
 
     void updateLatestPurchasePrice(Long pu_id);
 
     Product getProductsByPK(Long id);
+
+    /**
+     * 保存/更新
+     * @param product
+     * @return
+     */
+    DocBaseDTO saveData(Product product);
+
+    /**
+     * 关闭
+     * @param id
+     * @return
+     */
+    boolean close(Long id);
+
+    /**
+     * 开启
+     * @param id
+     * @return
+     */
+    boolean open(Long id);
 }

+ 51 - 2
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/VendorService.java

@@ -3,18 +3,67 @@ package com.usoftchina.saas.document.service;
 import com.github.pagehelper.PageInfo;
 import com.usoftchina.saas.base.service.CommonBaseService;
 
-
-import com.usoftchina.saas.commons.dto.DocReqDTO;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.commons.dto.ListReqDTO;
 import com.usoftchina.saas.document.dto.VendorDTO;
+import com.usoftchina.saas.document.dto.VendorListDTO;
 import com.usoftchina.saas.document.entities.Vendor;
+import com.usoftchina.saas.document.entities.VendorList;
 import com.usoftchina.saas.document.mapper.VendorMapper;
 
 import com.usoftchina.saas.page.PageRequest;
 
+import java.util.List;
+
 
 public interface VendorService extends CommonBaseService<VendorMapper, Vendor>{
 
+    /**
+     * 获取主表数据
+     * @param page      分页对象
+     * @param listReqDTO    条件对象
+     * @return  PageInfo<VendorDTO>
+     */
     PageInfo<VendorDTO> getVendorsByCondition(PageRequest page, ListReqDTO listReqDTO);
 
+    /**
+     * 通过ID 获取主从表数据
+     * @param id
+     * @return VendorListDTO
+     */
+    VendorListDTO getListById(Long id);
+
+    /**
+     * 获取供应商资料列表
+     * @param listReqDTO  条件对象
+     * @return List<VendorList>
+     */
+    List<VendorList> getListDataByCondition(ListReqDTO listReqDTO);
+
+    /**
+     * 保存主从表数据
+     * @param vendorListDTO
+     * @return  DocBaseDTO
+     */
+    DocBaseDTO saveFormData(VendorListDTO vendorListDTO);
+
+    /**
+     * 通过主表ID  删除主从表数据
+     * @param id
+     */
+    void deleteById(Long id);
+
+    /**
+     * 关闭
+     * @param id
+     * @return  boolean
+     */
+    boolean close(Long id);
+
+    /**
+     * 开启
+     * @param id
+     * @return  boolean
+     */
+    boolean open(Long id);
 }

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

@@ -1,6 +1,10 @@
 package com.usoftchina.saas.document.service.impl;
 
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
+import com.usoftchina.saas.commons.api.MessageLogService;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.commons.po.Messagelog;
+import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.document.entities.Address;
 import com.usoftchina.saas.document.mapper.AddressMapper;
 import com.usoftchina.saas.document.service.AddressService;
@@ -12,6 +16,10 @@ public class AddressServiceImpl extends CommonBaseServiceImpl<AddressMapper, Add
 
     @Autowired
     private AddressMapper addressMapper;
+    @Autowired
+    private MessageLogService messageLogService;
+
+
 
     /**
      * 保存
@@ -20,7 +28,16 @@ public class AddressServiceImpl extends CommonBaseServiceImpl<AddressMapper, Add
      */
     @Override
     public boolean save(Address address){
-        addressMapper.insertSelective(address);
+        if(address.getId() == 0){
+            address.setCompanyId(BaseContextHolder.getCompanyId());
+            addressMapper.insertSelective(address);
+            //记录LOG
+            messageLogService.save(generateMsgObj(address.getId()));
+        }else{
+            addressMapper.updateByPrimaryKeySelective(address);
+            //记录LOG
+            messageLogService.update(generateMsgObj(address.getId()));
+        }
         return true;
     }
 
@@ -33,6 +50,7 @@ public class AddressServiceImpl extends CommonBaseServiceImpl<AddressMapper, Add
     public boolean removeByPrimaryKey(Long id){
         if(id != null && id > 0){
             addressMapper.deleteByPrimaryKey(id);
+            messageLogService.delete(generateMsgObj(id));
         }
         return true;
     }
@@ -47,4 +65,8 @@ public class AddressServiceImpl extends CommonBaseServiceImpl<AddressMapper, Add
             addressMapper.deleteByIds(ids);
         }
     }
+
+    private DocBaseDTO generateMsgObj(Long id){
+        return new DocBaseDTO(id, "", "Address");
+    }
 }

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

@@ -1,17 +1,24 @@
 package com.usoftchina.saas.document.service.impl;
 
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
+import com.usoftchina.saas.commons.api.MessageLogService;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.document.entities.Customerkind;
 import com.usoftchina.saas.document.mapper.CustomerkindMapper;
 import com.usoftchina.saas.document.service.CustomerkindService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 @Service
 public class CustomerkindServiceImpl extends CommonBaseServiceImpl<CustomerkindMapper, Customerkind> implements CustomerkindService {
 
     @Autowired
     private CustomerkindMapper customerkindMapper;
+    @Autowired
+    private MessageLogService messageLogService;
 
     /**
      * 保存
@@ -21,17 +28,44 @@ public class CustomerkindServiceImpl extends CommonBaseServiceImpl<CustomerkindM
     @Override
     public boolean save(Customerkind customerkind){
         if(customerkind.getId() == 0){
+            customerkind.setCompanyId(BaseContextHolder.getCompanyId());
             customerkindMapper.insertSelective(customerkind);
+            //记录LOG
+            messageLogService.save(generateMsgObj(customerkind.getId()));
         }else{
             customerkindMapper.updateByPrimaryKeySelective(customerkind);
+            //记录LOG
+            messageLogService.update(generateMsgObj(customerkind.getId()));
         }
         return true;
     }
 
+    /**
+     * 删除
+     * @param id
+     * @return
+     */
     @Override
     public boolean removeByPrimaryKey(Long id){
-        customerkindMapper.deleteByPrimaryKey(id);
+        if(id != null && id > 0){
+            customerkindMapper.deleteByPrimaryKey(id);
+            messageLogService.delete(generateMsgObj(id));
+        }
         return true;
     }
 
+    /**
+     * 构造 记录日志对象
+     * @param id
+     * @return
+     */
+    private DocBaseDTO generateMsgObj(Long id){
+        return new DocBaseDTO(id, "", "CustomerKind");
+    }
+
+    @Override
+    public List<Customerkind> getCombo() {
+        List<Customerkind> customerkindList = getMapper().getCombo();
+        return customerkindList;
+    }
 }

+ 21 - 2
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/FundinouttypeServiceImpl.java

@@ -1,10 +1,14 @@
 package com.usoftchina.saas.document.service.impl;
 
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
+import com.usoftchina.saas.commons.api.MessageLogService;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.commons.po.Messagelog;
 import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.document.entities.Fundinouttype;
 import com.usoftchina.saas.document.mapper.FundinouttypeMapper;
 import com.usoftchina.saas.document.service.FundinouttypeService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
@@ -12,6 +16,9 @@ import java.util.List;
 @Service
 public class FundinouttypeServiceImpl extends CommonBaseServiceImpl<FundinouttypeMapper, Fundinouttype> implements FundinouttypeService {
 
+    @Autowired
+    private MessageLogService messageLogService;
+
     /**
      * 保存/更新
      * @param fundinouttype
@@ -19,11 +26,15 @@ public class FundinouttypeServiceImpl extends CommonBaseServiceImpl<Fundinouttyp
      */
     @Override
     public boolean save(Fundinouttype fundinouttype){
-        fundinouttype.setCompanyId(BaseContextHolder.getCompanyId());
         if(fundinouttype.getId() == 0){
+            fundinouttype.setCompanyId(BaseContextHolder.getCompanyId());
             getMapper().insertSelective(fundinouttype);
+            //记录LOG
+            messageLogService.save(generateMsgObj(fundinouttype.getId()));
         }else{
             getMapper().updateByPrimaryKeySelective(fundinouttype);
+            //记录LOG
+            messageLogService.update(generateMsgObj(fundinouttype.getId()));
         }
         return true;
     }
@@ -35,8 +46,16 @@ public class FundinouttypeServiceImpl extends CommonBaseServiceImpl<Fundinouttyp
      */
     @Override
     public boolean removeByPrimaryKey(Long id){
-        getMapper().deleteByPrimaryKey(id);
+        if(id != null && id > 0){
+            getMapper().deleteByPrimaryKey(id);
+            //记录LOG
+            messageLogService.delete(generateMsgObj(id));
+        }
         return true;
     }
 
+    private DocBaseDTO generateMsgObj(Long id){
+        return new DocBaseDTO(id, null, "FundInOutType");
+    }
+
 }

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

@@ -3,13 +3,20 @@ package com.usoftchina.saas.document.service.impl;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
+import com.usoftchina.saas.commons.api.MessageLogService;
 import com.usoftchina.saas.commons.dto.ComboDTO;
-import com.usoftchina.saas.commons.dto.DocReqDTO;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.commons.exception.BizExceptionCode;
+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.entities.Product;
 import com.usoftchina.saas.document.mapper.ProductMapper;
 import com.usoftchina.saas.document.service.ProductService;
+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 java.util.List;
@@ -17,8 +24,11 @@ import java.util.List;
 @Service
 public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Product> implements ProductService {
 
+    @Autowired
+    private MessageLogService messageLogService;
+
     @Override
-    public PageInfo<ProductDTO> getProductsByCondition(PageRequest page, DocReqDTO docReqDTO) {
+    public PageInfo<ProductDTO> getProductsByCondition(PageRequest page, ListReqDTO listReqDTO) {
         //设置分页
         if (null == page || page.getSize() == 0 || page.getNumber() == 0) {
             page = new PageRequest();
@@ -26,7 +36,7 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
             page.setSize(10);
         }
         PageHelper.startPage(page.getNumber(), page.getSize());
-        List<ProductDTO> productList = getMapper().getProductsByCondition(docReqDTO);
+        List<ProductDTO> productList = getList(listReqDTO);
         //取分页信息
         PageInfo<ProductDTO> pageInfo = new PageInfo<ProductDTO>(productList);
         return pageInfo;
@@ -40,13 +50,90 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
     @Override
     public void updateLatestPurchasePrice(Long pu_id) {
         getMapper().updateLatestPurchasePrice(pu_id);
+        messageLogService.update(generateMsgObj(pu_id));
     }
 
     @Override
     public Product getProductsByPK(Long id) {
-        if (null == id) {
+        if (null != id) {
             return getMapper().selectByPrimaryKey(id);
         }
         return null;
     }
+
+    @Override
+    public DocBaseDTO saveData(Product product){
+        DocBaseDTO docBaseDTO = null;
+        if(product.getId() == 0){
+            product.setCompanyId(BaseContextHolder.getCompanyId());
+            getMapper().insertSelective(product);
+            docBaseDTO = generateMsgObj(product.getId());
+            //记录LOG
+            messageLogService.save(docBaseDTO);
+        }else{
+            getMapper().updateByPrimaryKeySelective(product);
+            docBaseDTO = generateMsgObj(product.getId());
+            //记录LOG
+            messageLogService.update(docBaseDTO);
+        }
+        return docBaseDTO;
+    }
+
+    @Override
+    public boolean close(Long id) {
+        if(id != null && id > 0){
+            Product product = new Product();
+            product.setId(id);
+            product.setPr_status(Status.CLOSE.getDisplay());
+            product.setPr_statuscode(Status.CLOSE.name());
+            getMapper().updateByPrimaryKeySelective(product);
+            //记录LOG
+            messageLogService.close(generateMsgObj(id));
+            return true;
+        }else{
+            throw new BizException(BizExceptionCode.ILLEGAL_ID);
+        }
+    }
+
+    @Override
+    public boolean open(Long id) {
+        if(id != null && id > 0){
+            Product product = getMapper().selectByPrimaryKey(id);
+            if (product == null) {
+                throw new BizException(BizExceptionCode.NO_DATA);
+            }
+            if (!Status.CLOSE.getDisplay().equals(product.getPr_status())){
+                throw new BizException(BizExceptionCode.BIZ_OPEN);
+            }else{
+                product.setId(id);
+                product.setPr_statuscode(Status.OPEN.name());
+                product.setPr_status(Status.OPEN.getDisplay());
+                getMapper().updateByPrimaryKeySelective(product);
+                //记录LOG
+                messageLogService.open(generateMsgObj(id));
+                return true;
+            }
+        }else{
+            throw new BizException(BizExceptionCode.ILLEGAL_ID);
+        }
+    }
+
+    private List<ProductDTO> getList(ListReqDTO listReqDTO){
+        Long companyId = BaseContextHolder.getCompanyId();
+        String condition = listReqDTO.getFinalCondition();
+        if(condition == null){
+            condition = "1=1";
+        }
+        List<ProductDTO> productDTOList = getMapper().getProductsByCondition(condition, companyId);
+        return productDTOList;
+    }
+
+    /**
+     * 构造日记记录对象
+     * @param id
+     * @return
+     */
+    private DocBaseDTO generateMsgObj(Long id){
+        return new DocBaseDTO(id, "", "Product");
+    }
 }

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

@@ -1,6 +1,7 @@
 package com.usoftchina.saas.document.service.impl;
 
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
+import com.usoftchina.saas.commons.api.MessageLogService;
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.document.entities.Productbrand;
@@ -14,10 +15,10 @@ public class ProductbrandServiceImpl extends CommonBaseServiceImpl<ProductbrandM
 
     @Autowired
     private ProductbrandMapper productbrandMapper;
-//    @Autowired
-//    private MessageLogService messageLogService;
+    @Autowired
+    private MessageLogService messageLogService;
 
-    private final String LOG_NAME = "物料品牌";
+    private final String LOG_NAME = "ProductBrand";
 
     @Override
     public boolean save(Productbrand productbrand){
@@ -26,12 +27,12 @@ public class ProductbrandServiceImpl extends CommonBaseServiceImpl<ProductbrandM
             productbrandMapper.insertSelective(productbrand);
             //记录日志
             DocBaseDTO docBaseDTO = new DocBaseDTO(productbrand.getId(), null, LOG_NAME);
-//            messageLogService.save(docBaseDTO);
+            messageLogService.save(docBaseDTO);
         }else{
             productbrandMapper.updateByPrimaryKeySelective(productbrand);
             //记录日志
             DocBaseDTO docBaseDTO = new DocBaseDTO(productbrand.getId(), null, LOG_NAME);
-//            messageLogService.update(docBaseDTO);
+            messageLogService.update(docBaseDTO);
         }
         return true;
     }
@@ -41,7 +42,7 @@ public class ProductbrandServiceImpl extends CommonBaseServiceImpl<ProductbrandM
         productbrandMapper.deleteByPrimaryKey(id);
         //记录日志
         DocBaseDTO docBaseDTO = new DocBaseDTO(id, null, LOG_NAME);
-//        messageLogService.delete(docBaseDTO);
+        messageLogService.delete(docBaseDTO);
         return true;
     }
 

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

@@ -1,6 +1,9 @@
 package com.usoftchina.saas.document.service.impl;
 
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
+import com.usoftchina.saas.commons.api.MessageLogService;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.document.entities.Producttype;
 import com.usoftchina.saas.document.mapper.ProducttypeMapper;
 import com.usoftchina.saas.document.service.ProducttypeService;
@@ -14,6 +17,8 @@ public class ProducttypeServiceImpl extends CommonBaseServiceImpl<ProducttypeMap
 
     @Autowired
     private ProducttypeMapper producttypeMapper;
+    @Autowired
+    private MessageLogService messageLogService;
 
     /**
      * 保存
@@ -23,9 +28,14 @@ public class ProducttypeServiceImpl extends CommonBaseServiceImpl<ProducttypeMap
     @Override
     public boolean save(Producttype producttype){
         if(producttype.getId() == 0){
+            producttype.setCompanyId(BaseContextHolder.getCompanyId());
             producttypeMapper.insertSelective(producttype);
+            //记录LOG
+            messageLogService.save(generateMsgObj(producttype.getId()));
         }else{
             producttypeMapper.updateByPrimaryKeySelective(producttype);
+            //记录LOG
+            messageLogService.update(generateMsgObj(producttype.getId()));
         }
         return true;
     }
@@ -37,8 +47,21 @@ public class ProducttypeServiceImpl extends CommonBaseServiceImpl<ProducttypeMap
      */
     @Override
     public boolean removeByPrimaryKey(Long id){
-        producttypeMapper.deleteByPrimaryKey(id);
+        if(id != null && id > 0){
+            producttypeMapper.deleteByPrimaryKey(id);
+            //记录LOG
+            messageLogService.delete(generateMsgObj(id));
+        }
         return true;
     }
 
+    /**
+     * 构造 记录日志对象
+     * @param id
+     * @return
+     */
+    private DocBaseDTO generateMsgObj(Long id){
+        return new DocBaseDTO(id, "", "ProductType");
+    }
+
 }

+ 25 - 2
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProductunitServiceImpl.java

@@ -1,10 +1,13 @@
 package com.usoftchina.saas.document.service.impl;
 
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
+import com.usoftchina.saas.commons.api.MessageLogService;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.document.entities.Productunit;
 import com.usoftchina.saas.document.mapper.ProductunitMapper;
 import com.usoftchina.saas.document.service.ProductunitService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
@@ -12,20 +15,31 @@ import java.util.List;
 @Service
 public class ProductunitServiceImpl extends CommonBaseServiceImpl<ProductunitMapper, Productunit> implements ProductunitService {
 
+    @Autowired
+    private MessageLogService messageLogService;
+
     @Override
     public boolean save(Productunit productunit){
-        productunit.setCompanyId(BaseContextHolder.getCompanyId());
         if(productunit.getId() == 0){
+            productunit.setCompanyId(BaseContextHolder.getCompanyId());
             getMapper().insertSelective(productunit);
+            //记录LOG
+            messageLogService.save(generateMsgObj(productunit.getId()));
         }else{
             getMapper().updateByPrimaryKeySelective(productunit);
+            //记录LOG
+            messageLogService.update(generateMsgObj(productunit.getId()));
         }
         return true;
     }
 
     @Override
     public boolean removeByPrimaryKey(Long id){
-        getMapper().deleteByPrimaryKey(id);
+        if(id != null && id > 0){
+            getMapper().deleteByPrimaryKey(id);
+            //记录LOG
+            messageLogService.delete(generateMsgObj(id));
+        }
         return true;
     }
 
@@ -35,4 +49,13 @@ public class ProductunitServiceImpl extends CommonBaseServiceImpl<ProductunitMap
         return productunitList;
     }
 
+    /**
+     * 构造 记录日志对象
+     * @param id
+     * @return
+     */
+    private DocBaseDTO generateMsgObj(Long id){
+        return new DocBaseDTO(id, "", "ProductUnit");
+    }
+
 }

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

@@ -3,15 +3,23 @@ package com.usoftchina.saas.document.service.impl;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
-import com.usoftchina.saas.commons.dto.DocReqDTO;
+import com.usoftchina.saas.commons.api.MessageLogService;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.commons.exception.BizExceptionCode;
+import com.usoftchina.saas.commons.po.Status;
 import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.document.dto.VendorDTO;
+import com.usoftchina.saas.document.dto.VendorListDTO;
 import com.usoftchina.saas.document.entities.Vendor;
+import com.usoftchina.saas.document.entities.VendorList;
+import com.usoftchina.saas.document.entities.Vendorcontact;
 import com.usoftchina.saas.document.mapper.VendorMapper;
+import com.usoftchina.saas.document.mapper.VendorcontactMapper;
 import com.usoftchina.saas.document.service.VendorService;
+import com.usoftchina.saas.exception.BizException;
 import com.usoftchina.saas.page.PageRequest;
-import com.usoftchina.saas.utils.BeanMapper;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
@@ -23,6 +31,11 @@ import java.util.List;
 @Service
 public class VendorServiceImpl extends CommonBaseServiceImpl<VendorMapper, Vendor> implements VendorService {
 
+    @Autowired
+    private VendorcontactMapper vendorcontactMapper;
+    @Autowired
+    private MessageLogService messageLogService;
+
     @Override
     public PageInfo<VendorDTO> getVendorsByCondition(PageRequest page, ListReqDTO listReqDTO) {
         //设置分页
@@ -38,6 +51,126 @@ public class VendorServiceImpl extends CommonBaseServiceImpl<VendorMapper, Vendo
         return pageInfo;
     }
 
+    /**
+     * 通过ID查找主从表数据
+     * @param id
+     * @return
+     */
+    @Override
+    public VendorListDTO getListById(Long id) {
+        VendorListDTO vendorListDTO = new VendorListDTO();
+        Vendor vendor = getMapper().selectByPrimaryKey(id);
+        List<Vendorcontact> vendorcontactList = vendorcontactMapper.selectByFK(id);
+        //设置主从表信息
+        vendorListDTO.setMain(vendor);
+        vendorListDTO.setItems(vendorcontactList);
+        return vendorListDTO;
+    }
+
+    /**
+     * 返回列表数据
+     * @return
+     */
+    public List<VendorList> getListDataByCondition(ListReqDTO listReqDTO){
+        String condition = listReqDTO.getFinalCondition();
+        return getMapper().getListDataByCondition(condition, BaseContextHolder.getCompanyId());
+    }
+
+    /**
+     * 保存主从表数据
+     * @param vendorListDTO
+     */
+    @Override
+    public DocBaseDTO saveFormData(VendorListDTO vendorListDTO) {
+        Vendor main = vendorListDTO.getMain();
+        main.setCompanyId(BaseContextHolder.getCompanyId());
+        List<Vendorcontact> items = vendorListDTO.getItems();
+        if(main.getId() == 0){
+            //保存主表信息
+            getMapper().insertSelective(main);
+            Long mainId = main.getId();
+            //更新明细表vc_veid
+            for(Vendorcontact item : items){
+                item.setVc_veid(mainId);
+                item.setCompanyId(BaseContextHolder.getCompanyId());
+            }
+            //保存明细表信息
+            vendorcontactMapper.batchInsert(items);
+            //记录LOG
+            messageLogService.save(generateMsgObj(mainId));
+        }else{
+            getMapper().updateByPrimaryKeySelective(main);
+            vendorcontactMapper.batchUpdate(items);
+            //记录LOG
+            messageLogService.update(generateMsgObj(main.getId()));
+        }
+        return generateMsgObj(main.getId());
+    }
+
+    /**
+     * 删除主从表数据
+     * @param id
+     */
+    @Override
+    public void deleteById(Long id) {
+        if(id != null && id > 0){
+            getMapper().deleteByPrimaryKey(id);
+            vendorcontactMapper.deleteByFK(id);
+            //记录LOG
+            messageLogService.delete(generateMsgObj(id));
+        }
+    }
+
+    /**
+     * 关闭
+     * @param id
+     * @return
+     */
+    @Override
+    public boolean close(Long id){
+        if(id != null && id > 0){
+            Vendor vendor = new Vendor();
+            vendor.setId(id);
+            vendor.setVe_status(Status.CLOSE.getDisplay());
+            vendor.setVe_statuscode(Status.CLOSE.name());
+            getMapper().updateByPrimaryKeySelective(vendor);
+            //记录LOG
+            messageLogService.close(generateMsgObj(id));
+            return true;
+        }else{
+            throw new BizException(BizExceptionCode.ILLEGAL_ID);
+        }
+    }
+
+    /**
+     * 开启
+     * @param id
+     * @return
+     */
+    @Override
+    public boolean open(Long id){
+        if (id != null && id > 0){
+            Vendor vendor = getMapper().selectByPrimaryKey(id);
+            if(vendor == null){
+                throw new BizException(BizExceptionCode.NO_DATA);
+            }
+            if (Status.CLOSE.name().equals(vendor.getVe_statuscode())){
+                vendor = new Vendor();
+                vendor.setId(id);
+                vendor.setVe_statuscode(Status.OPEN.name());
+                vendor.setVe_status(Status.OPEN.getDisplay());
+                getMapper().updateByPrimaryKeySelective(vendor);
+                //记录LOG
+                messageLogService.open(generateMsgObj(id));
+                return true;
+            }else {
+                throw new BizException(BizExceptionCode.BIZ_OPEN);
+            }
+        }else {
+            throw new BizException(BizExceptionCode.ILLEGAL_ID);
+        }
+    }
+
     private List<VendorDTO> getList(ListReqDTO listReqDTO){
         Long companyId = BaseContextHolder.getCompanyId();
         String condition = listReqDTO.getFinalCondition();
@@ -48,4 +181,13 @@ public class VendorServiceImpl extends CommonBaseServiceImpl<VendorMapper, Vendo
         return vendorDTOList;
     }
 
+    /**
+     * 构造日记记录对象
+     * @param id
+     * @return
+     */
+    private DocBaseDTO generateMsgObj(Long id){
+        return new DocBaseDTO(id, "", "Vendor");
+    }
+
 }

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

@@ -1,6 +1,9 @@
 package com.usoftchina.saas.document.service.impl;
 
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
+import com.usoftchina.saas.commons.api.MessageLogService;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.document.entities.Vendorkind;
 import com.usoftchina.saas.document.mapper.VendorkindMapper;
 import com.usoftchina.saas.document.service.VendorkindService;
@@ -12,21 +15,40 @@ public class VendorkindServiceImpl extends CommonBaseServiceImpl<VendorkindMappe
 
     @Autowired
     private VendorkindMapper vendorkindMapper;
+    @Autowired
+    private MessageLogService messageLogService;
 
     @Override
     public boolean save(Vendorkind vendorkind){
         if(vendorkind.getId() == 0){
+            vendorkind.setCompanyId(BaseContextHolder.getCompanyId());
             vendorkindMapper.insertSelective(vendorkind);
+            //记录LOG
+            messageLogService.save(generateMsgObj(vendorkind.getId()));
         }else{
             vendorkindMapper.updateByPrimaryKeySelective(vendorkind);
+            //记录LOG
+            messageLogService.update(generateMsgObj(vendorkind.getId()));
         }
         return true;
     }
 
     @Override
     public boolean removeByPrimaryKey(Long id){
-        vendorkindMapper.deleteByPrimaryKey(id);
+        if(id != null && id > 0){
+            vendorkindMapper.deleteByPrimaryKey(id);
+            //记录LOG
+            messageLogService.delete(generateMsgObj(id));
+        }
         return true;
     }
 
+    /**
+     * 构造 记录日志对象
+     * @param id
+     * @return
+     */
+    private DocBaseDTO generateMsgObj(Long id){
+        return new DocBaseDTO(id, "", "VendorKind");
+    }
 }

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

@@ -1,10 +1,13 @@
 package com.usoftchina.saas.document.service.impl;
 
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
+import com.usoftchina.saas.commons.api.MessageLogService;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.document.entities.Warehouse;
 import com.usoftchina.saas.document.mapper.WarehouseMapper;
 import com.usoftchina.saas.document.service.WarehouseService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.HashMap;
@@ -13,6 +16,9 @@ import java.util.Map;
 @Service
 public class WarehouseServiceImpl extends CommonBaseServiceImpl<WarehouseMapper, Warehouse> implements WarehouseService {
 
+    @Autowired
+    private MessageLogService messageLogService;
+
     /**
      * 过账
      * @param map
@@ -48,7 +54,16 @@ public class WarehouseServiceImpl extends CommonBaseServiceImpl<WarehouseMapper,
      */
     @Override
     public int insertSelective(Warehouse record) {
-        int count = getMapper().insertSelective(record);
+        int count = 0;
+        if(record.getId() == 0){
+            count = getMapper().insertSelective(record);
+            //记录LOG
+            messageLogService.save(generateMsgObj(record.getId()));
+        }else{
+            getMapper().updateByPrimaryKeySelective(record);
+            //记录LOG
+            messageLogService.update(generateMsgObj(record.getId()));
+        }
         return count;
     }
 
@@ -60,4 +75,13 @@ public class WarehouseServiceImpl extends CommonBaseServiceImpl<WarehouseMapper,
     public void unPost(Map<String, Object> map) {
         getMapper().unPost(map);
     }
+
+    /**
+     * 构造 记录日志对象
+     * @param id
+     * @return
+     */
+    private DocBaseDTO generateMsgObj(Long id){
+        return new DocBaseDTO(id, "", "Warehouse");
+    }
 }

+ 3 - 0
applications/document/document-server/src/main/resources/mapper/CustomerkindMapper.xml

@@ -122,4 +122,7 @@
   <select id="selectAll" resultMap="BaseResultMap">
     SELECT * FROM CUSTOMERKIND
   </select>
+  <select id="getCombo" resultType="com.usoftchina.saas.commons.dto.ComboDTO">
+    SELECT ck_name display,ck_name value FROM CUSTOMERKIND
+  </select>
 </mapper>

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

@@ -50,5 +50,54 @@
         ORDER BY VE_ID
     </select>
 
+    <resultMap id="VendorListResultMapper" type="com.usoftchina.saas.document.entities.VendorList">
+        <id column="ve_id" property="ve_id" jdbcType="INTEGER" />
+        <result column="ve_code" property="ve_code" jdbcType="VARCHAR" />
+        <result column="ve_uu" property="ve_uu" jdbcType="VARCHAR" />
+        <result column="ve_name" property="ve_name" jdbcType="VARCHAR" />
+        <result column="ve_type" property="ve_type" jdbcType="VARCHAR" />
+        <result column="ve_begindate" property="ve_begindate" jdbcType="TIMESTAMP" />
+        <result column="ve_beginapamount" property="ve_beginapamount" jdbcType="INTEGER" />
+        <result column="ve_beginprepayamount" property="ve_beginprepayamount" jdbcType="INTEGER" />
+        <result column="ve_promisedays" property="ve_promisedays" jdbcType="INTEGER" />
+        <result column="ve_taxrate" property="ve_taxrate" jdbcType="DOUBLE" />
+        <result column="ve_nsrzh" property="ve_nsrzh" jdbcType="VARCHAR" />
+        <result column="ve_bankaccount" property="ve_bankaccount" jdbcType="VARCHAR" />
+        <result column="ve_bankcode" property="ve_bankcode" jdbcType="VARCHAR" />
+        <result column="ve_status" property="ve_status" jdbcType="VARCHAR" />
+        <result column="ve_statuscode" property="ve_statuscode" jdbcType="VARCHAR" />
+        <result column="ve_recordid" property="ve_recordid" jdbcType="INTEGER" />
+        <result column="ve_recordname" property="ve_recordname" jdbcType="VARCHAR" />
+        <result column="ve_initdate" property="ve_initdate" jdbcType="TIMESTAMP" />
+        <result column="ve_text1" property="ve_text1" jdbcType="VARCHAR" />
+        <result column="ve_text2" property="ve_text2" jdbcType="VARCHAR" />
+        <result column="ve_text3" property="ve_text3" jdbcType="VARCHAR" />
+        <result column="ve_text4" property="ve_text4" jdbcType="VARCHAR" />
+        <result column="ve_text5" property="ve_text5" jdbcType="VARCHAR" />
+        <result column="vc_veid" property="vc_veid" jdbcType="INTEGER" />
+        <result column="vc_detno" property="vc_detno" jdbcType="INTEGER" />
+        <result column="vc_name" property="vc_name" jdbcType="VARCHAR" />
+        <result column="vc_tel" property="vc_tel" jdbcType="INTEGER" />
+        <result column="vc_qq" property="vc_qq" jdbcType="VARCHAR" />
+        <result column="vc_email" property="vc_email" jdbcType="VARCHAR" />
+        <result column="vc_text1" property="vc_text1" jdbcType="VARCHAR" />
+        <result column="vc_text2" property="vc_text2" jdbcType="VARCHAR" />
+        <result column="vc_text3" property="vc_text3" jdbcType="VARCHAR" />
+        <result column="vc_text4" property="vc_text4" jdbcType="VARCHAR" />
+        <result column="vc_text5" property="vc_text5" jdbcType="VARCHAR" />
+        <result column="vc_default" property="vc_default" jdbcType="VARCHAR" />
+    </resultMap>
+
+    <select id="getListDataByCondition" resultMap="VendorListResultMapper">
+        SELECT * FROM VENDOR LEFT JOIN VENDORCONTACT ON VE_ID = VC_VEID
+        <where>
+            <if test="condition!=null">
+                ${condition}
+            </if>
+            AND VENDOR.COMPANYID = #{companyId}
+        </where>
+        order by VE_ID,VC_DETNO
+    </select>
+
 </mapper>
 

+ 219 - 49
applications/document/document-server/src/main/resources/mapper/VendorcontactMapper.xml

@@ -12,15 +12,16 @@
     <result column="companyId" property="companyId" jdbcType="INTEGER" />
     <result column="updaterId" property="updaterId" jdbcType="INTEGER" />
     <result column="updateTime" property="updateTime" jdbcType="TIMESTAMP" />
-    <result column="ve_text1" property="ve_text1" jdbcType="VARCHAR" />
-    <result column="ve_text2" property="ve_text2" jdbcType="VARCHAR" />
-    <result column="ve_text3" property="ve_text3" jdbcType="VARCHAR" />
-    <result column="ve_text4" property="ve_text4" jdbcType="VARCHAR" />
-    <result column="ve_text5" property="ve_text5" jdbcType="VARCHAR" />
+    <result column="vc_text1" property="vc_text1" jdbcType="VARCHAR" />
+    <result column="vc_text2" property="vc_text2" jdbcType="VARCHAR" />
+    <result column="vc_text3" property="vc_text3" jdbcType="VARCHAR" />
+    <result column="vc_text4" property="vc_text4" jdbcType="VARCHAR" />
+    <result column="vc_text5" property="vc_text5" jdbcType="VARCHAR" />
+    <result column="vc_default" property="vc_default" jdbcType="VARCHAR" />
   </resultMap>
   <sql id="Base_Column_List" >
     vc_id, vc_veid, vc_detno, vc_name, vc_tel, vc_qq, vc_email, companyId, updaterId, 
-    updateTime, ve_text1, ve_text2, ve_text3, ve_text4, ve_text5
+    updateTime, vc_text1, vc_text2, vc_text3, vc_text4, vc_text5, ve_default
   </sql>
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
     select 
@@ -28,22 +29,33 @@
     from vendorcontact
     where vc_id = #{id}
   </select>
+  <select id="selectByFK" resultMap="BaseResultMap" parameterType="java.lang.Long" >
+    select
+    <include refid="Base_Column_List" />
+    from vendorcontact
+    where vc_veid = #{id}
+  </select>
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
     delete from vendorcontact
     where vc_id = #{id}
   </delete>
+  <delete id="deleteByFK" parameterType="java.lang.Long">
+    DELETE FROM VENDORCONTACT
+    WHERE VC_VEID=#{id}
+  </delete>
   <insert id="insert" parameterType="com.usoftchina.saas.document.entities.Vendorcontact" >
     insert into vendorcontact (vc_veid, vc_detno,
       vc_name, vc_tel, vc_qq, 
       vc_email, companyId, updaterId, 
-      updateTime, ve_text1, ve_text2, 
-      ve_text3, ve_text4, ve_text5
+      updateTime, vc_text1, vc_text2, 
+      vc_text3, vc_text4, vc_text5, ve_default
       )
-    values (#{vc_veid,jdbcType=INTEGER}, #{vc_detno,jdbcType=INTEGER},
+    values (#{vc_veid}, #{vc_detno,jdbcType=INTEGER},
       #{vc_name,jdbcType=VARCHAR}, #{vc_tel,jdbcType=INTEGER}, #{vc_qq,jdbcType=VARCHAR}, 
       #{vc_email,jdbcType=VARCHAR}, #{companyId,jdbcType=INTEGER}, #{updaterId,jdbcType=INTEGER}, 
-      #{updateTime,jdbcType=TIMESTAMP}, #{ve_text1,jdbcType=VARCHAR}, #{ve_text2,jdbcType=VARCHAR}, 
-      #{ve_text3,jdbcType=VARCHAR}, #{ve_text4,jdbcType=VARCHAR}, #{ve_text5,jdbcType=VARCHAR}
+      #{updateTime,jdbcType=TIMESTAMP}, #{vc_text1,jdbcType=VARCHAR}, #{vc_text2,jdbcType=VARCHAR}, 
+      #{vc_text3,jdbcType=VARCHAR}, #{vc_text4,jdbcType=VARCHAR}, #{vc_text5,jdbcType=VARCHAR},
+      #{ve_default,jdbcType=VARCHAR}
       )
   </insert>
   <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.Vendorcontact" >
@@ -76,25 +88,28 @@
       <if test="updateTime != null" >
         updateTime,
       </if>
-      <if test="ve_text1 != null" >
-        ve_text1,
+      <if test="vc_text1 != null" >
+        vc_text1,
+      </if>
+      <if test="vc_text2 != null" >
+        vc_text2,
       </if>
-      <if test="ve_text2 != null" >
-        ve_text2,
+      <if test="vc_text3 != null" >
+        vc_text3,
       </if>
-      <if test="ve_text3 != null" >
-        ve_text3,
+      <if test="vc_text4 != null" >
+        vc_text4,
       </if>
-      <if test="ve_text4 != null" >
-        ve_text4,
+      <if test="vc_text5 != null" >
+        vc_text5,
       </if>
-      <if test="ve_text5 != null" >
-        ve_text5,
+      <if test="ve_default != null" >
+        ve_default,
       </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides="," >
       <if test="vc_veid != null" >
-        #{vc_veid,jdbcType=INTEGER},
+        #{vc_veid},
       </if>
       <if test="vc_detno != null" >
         #{vc_detno,jdbcType=INTEGER},
@@ -120,20 +135,23 @@
       <if test="updateTime != null" >
         #{updateTime,jdbcType=TIMESTAMP},
       </if>
-      <if test="ve_text1 != null" >
-        #{ve_text1,jdbcType=VARCHAR},
+      <if test="vc_text1 != null" >
+        #{vc_text1,jdbcType=VARCHAR},
+      </if>
+      <if test="vc_text2 != null" >
+        #{vc_text2,jdbcType=VARCHAR},
       </if>
-      <if test="ve_text2 != null" >
-        #{ve_text2,jdbcType=VARCHAR},
+      <if test="vc_text3 != null" >
+        #{vc_text3,jdbcType=VARCHAR},
       </if>
-      <if test="ve_text3 != null" >
-        #{ve_text3,jdbcType=VARCHAR},
+      <if test="vc_text4 != null" >
+        #{vc_text4,jdbcType=VARCHAR},
       </if>
-      <if test="ve_text4 != null" >
-        #{ve_text4,jdbcType=VARCHAR},
+      <if test="vc_text5 != null" >
+        #{vc_text5,jdbcType=VARCHAR},
       </if>
-      <if test="ve_text5 != null" >
-        #{ve_text5,jdbcType=VARCHAR},
+      <if test="ve_default != null" >
+        #{ve_default,jdbcType=VARCHAR},
       </if>
     </trim>
   </insert>
@@ -141,7 +159,7 @@
     update vendorcontact
     <set >
       <if test="vc_veid != null" >
-        vc_veid = #{vc_veid,jdbcType=INTEGER},
+        vc_veid = #{vc_veid},
       </if>
       <if test="vc_detno != null" >
         vc_detno = #{vc_detno,jdbcType=INTEGER},
@@ -167,27 +185,30 @@
       <if test="updateTime != null" >
         updateTime = #{updateTime,jdbcType=TIMESTAMP},
       </if>
-      <if test="ve_text1 != null" >
-        ve_text1 = #{ve_text1,jdbcType=VARCHAR},
+      <if test="vc_text1 != null" >
+        vc_text1 = #{vc_text1,jdbcType=VARCHAR},
       </if>
-      <if test="ve_text2 != null" >
-        ve_text2 = #{ve_text2,jdbcType=VARCHAR},
+      <if test="vc_text2 != null" >
+        vc_text2 = #{vc_text2,jdbcType=VARCHAR},
       </if>
-      <if test="ve_text3 != null" >
-        ve_text3 = #{ve_text3,jdbcType=VARCHAR},
+      <if test="vc_text3 != null" >
+        vc_text3 = #{vc_text3,jdbcType=VARCHAR},
       </if>
-      <if test="ve_text4 != null" >
-        ve_text4 = #{ve_text4,jdbcType=VARCHAR},
+      <if test="vc_text4 != null" >
+        vc_text4 = #{vc_text4,jdbcType=VARCHAR},
       </if>
-      <if test="ve_text5 != null" >
-        ve_text5 = #{ve_text5,jdbcType=VARCHAR},
+      <if test="vc_text5 != null" >
+        vc_text5 = #{vc_text5,jdbcType=VARCHAR},
+      </if>
+      <if test="ve_default != null" >
+        ve_default = #{ve_default,jdbcType=VARCHAR},
       </if>
     </set>
     where vc_id = #{id}
   </update>
   <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.document.entities.Vendorcontact" >
     update vendorcontact
-    set vc_veid = #{vc_veid,jdbcType=INTEGER},
+    set vc_veid = #{vc_veid},
       vc_detno = #{vc_detno,jdbcType=INTEGER},
       vc_name = #{vc_name,jdbcType=VARCHAR},
       vc_tel = #{vc_tel,jdbcType=INTEGER},
@@ -196,11 +217,160 @@
       companyId = #{companyId,jdbcType=INTEGER},
       updaterId = #{updaterId,jdbcType=INTEGER},
       updateTime = #{updateTime,jdbcType=TIMESTAMP},
-      ve_text1 = #{ve_text1,jdbcType=VARCHAR},
-      ve_text2 = #{ve_text2,jdbcType=VARCHAR},
-      ve_text3 = #{ve_text3,jdbcType=VARCHAR},
-      ve_text4 = #{ve_text4,jdbcType=VARCHAR},
-      ve_text5 = #{ve_text5,jdbcType=VARCHAR}
+      vc_text1 = #{vc_text1,jdbcType=VARCHAR},
+      vc_text2 = #{vc_text2,jdbcType=VARCHAR},
+      vc_text3 = #{vc_text3,jdbcType=VARCHAR},
+      vc_text4 = #{vc_text4,jdbcType=VARCHAR},
+      vc_text5 = #{vc_text5,jdbcType=VARCHAR},
+      ve_default = #{ve_default,jdbcType=VARCHAR}
     where vc_id = #{id}
   </update>
+  <insert id="batchInsert" parameterType="java.util.List">
+    <foreach collection="list" item="item" separator=",">
+      INSERT INTO VENDORCONTACT
+      <trim prefix="(" suffix=")" suffixOverrides=",">
+        <if test="item.vc_veid != null" >
+          vc_veid,
+        </if>
+        <if test="item.vc_detno != null" >
+          vc_detno,
+        </if>
+        <if test="item.vc_name != null" >
+          vc_name,
+        </if>
+        <if test="item.vc_tel != null" >
+          vc_tel,
+        </if>
+        <if test="item.vc_qq != null" >
+          vc_qq,
+        </if>
+        <if test="item.vc_email != null" >
+          vc_email,
+        </if>
+        <if test="item.companyId != null" >
+          companyId,
+        </if>
+        <if test="item.updaterId != null" >
+          updaterId,
+        </if>
+        <if test="item.updateTime != null" >
+          updateTime,
+        </if>
+        <if test="item.vc_text1 != null" >
+          vc_text1,
+        </if>
+        <if test="item.vc_text2 != null" >
+          vc_text2,
+        </if>
+        <if test="item.vc_text3 != null" >
+          vc_text3,
+        </if>
+        <if test="item.vc_text4 != null" >
+          vc_text4,
+        </if>
+        <if test="item.vc_text5 != null" >
+          vc_text5,
+        </if>
+        <if test="item.ve_default != null" >
+          ve_default,
+        </if>
+      </trim>
+      <trim prefix="(" suffix=")" suffixOverrides=",">
+        <if test="item.vc_veid != null" >
+          #{item.vc_veid},
+        </if>
+        <if test="item.vc_detno != null" >
+          #{item.vc_detno,jdbcType=INTEGER},
+        </if>
+        <if test="item.vc_name != null" >
+          #{item.vc_name,jdbcType=VARCHAR},
+        </if>
+        <if test="item.vc_tel != null" >
+          #{item.vc_tel,jdbcType=INTEGER},
+        </if>
+        <if test="item.vc_qq != null" >
+          #{item.vc_qq,jdbcType=VARCHAR},
+        </if>
+        <if test="item.vc_email != null" >
+          #{item.vc_email,jdbcType=VARCHAR},
+        </if>
+        <if test="item.companyId != null" >
+          #{item.companyId,jdbcType=INTEGER},
+        </if>
+        <if test="item.updaterId != null" >
+          #{item.updaterId,jdbcType=INTEGER},
+        </if>
+        <if test="item.updateTime != null" >
+          #{item.updateTime,jdbcType=TIMESTAMP},
+        </if>
+        <if test="item.vc_text1 != null" >
+          #{item.vc_text1,jdbcType=VARCHAR},
+        </if>
+        <if test="item.vc_text2 != null" >
+          #{item.vc_text2,jdbcType=VARCHAR},
+        </if>
+        <if test="item.vc_text3 != null" >
+          #{item.vc_text3,jdbcType=VARCHAR},
+        </if>
+        <if test="item.vc_text4 != null" >
+          #{item.vc_text4,jdbcType=VARCHAR},
+        </if>
+        <if test="item.vc_text5 != null" >
+          #{item.vc_text5,jdbcType=VARCHAR},
+        </if>
+        <if test="item.ve_default != null" >
+          #{item.ve_default,jdbcType=VARCHAR},
+        </if>
+      </trim>
+    </foreach>
+  </insert>
+  <update id="batchUpdate" parameterType="com.usoftchina.saas.document.entities.Vendorcontact">
+    <foreach collection="list" item="item" index="index" separator=";">
+      UPDATE VENDORCONTACT
+      <if test="item.vc_detno != null" >
+        vc_detno = #{item.vc_detno,jdbcType=INTEGER},
+      </if>
+      <if test="item.vc_name != null" >
+        vc_name = #{item.vc_name,jdbcType=VARCHAR},
+      </if>
+      <if test="item.vc_tel != null" >
+        vc_tel = #{item.vc_tel,jdbcType=INTEGER},
+      </if>
+      <if test="item.vc_qq != null" >
+        vc_qq = #{item.vc_qq,jdbcType=VARCHAR},
+      </if>
+      <if test="item.vc_email != null" >
+        vc_email = #{item.vc_email,jdbcType=VARCHAR},
+      </if>
+      <if test="item.companyId != null" >
+        companyId = #{item.companyId,jdbcType=INTEGER},
+      </if>
+      <if test="item.updaterId != null" >
+        updaterId = #{item.updaterId,jdbcType=INTEGER},
+      </if>
+      <if test="item.updateTime != null" >
+        updateTime = #{item.updateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="item.vc_text1 != null" >
+        vc_text1 = #{item.vc_text1,jdbcType=VARCHAR},
+      </if>
+      <if test="item.vc_text2 != null" >
+        vc_text2 = #{item.vc_text2,jdbcType=VARCHAR},
+      </if>
+      <if test="item.vc_text3 != null" >
+        vc_text3 = #{item.vc_text3,jdbcType=VARCHAR},
+      </if>
+      <if test="item.vc_text4 != null" >
+        vc_text4 = #{item.vc_text4,jdbcType=VARCHAR},
+      </if>
+      <if test="item.vc_text5 != null" >
+        vc_text5 = #{item.vc_text5,jdbcType=VARCHAR},
+      </if>
+      <if test="item.ve_default != null" >
+        ve_default = #{item.ve_default,jdbcType=VARCHAR},
+      </if>
+      WHERE VC_ID= #{item.id,jdbcType=INTEGER}
+    </foreach>
+  </update>
+
 </mapper>

+ 7 - 6
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/controller/PurchaseController.java

@@ -1,8 +1,10 @@
 package com.usoftchina.saas.purchase.controller;
 
 import com.github.pagehelper.PageInfo;
+import com.netflix.discovery.converters.Auto;
 import com.usoftchina.saas.base.Result;
 
+import com.usoftchina.saas.commons.api.MessageLogService;
 import com.usoftchina.saas.commons.dto.BatchDealBaseDTO;
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.commons.dto.ListReqDTO;
@@ -13,6 +15,7 @@ import com.usoftchina.saas.purchase.service.PurchaseService;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.context.request.async.DeferredResult;
 
 
 /**
@@ -69,7 +72,7 @@ public class PurchaseController {
      * @param id
      * @return
      */
-    @GetMapping("/delete/{id}")
+    @PostMapping("/delete/{id}")
     public Result delete(@PathVariable("id") Long id) {
         purchaseService.delete(id);
         return Result.success();
@@ -81,7 +84,7 @@ public class PurchaseController {
      * @param id
      * @return
      */
-    @GetMapping("/deleteDetail/{id}")
+    @PostMapping("/deleteDetail/{id}")
     public Result deleteDetail(@PathVariable("id") Long id) {
         purchaseService.deleteDetail(id);
         return Result.success();
@@ -105,7 +108,7 @@ public class PurchaseController {
      * @param id
      * @return
      */
-    @GetMapping("/unAudit/{id}")
+    @PostMapping("/unAudit/{id}")
     public Result unAudit(@PathVariable("id") Long id) {
         purchaseService.unAudit(id);
         return Result.success();
@@ -159,12 +162,10 @@ public class PurchaseController {
         return Result.success();
     }
 
-    @GetMapping("/turnProdin/{id}")
+    @PostMapping("/turnProdin/{id}")
     public Result turnProdin(@PathVariable("id") Long id){
         purchaseService.turnProdin(id);
         return Result.success();
     }
 
-
-
 }

+ 3 - 2
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/mapper/PurchaseMapper.java

@@ -23,9 +23,10 @@ public interface PurchaseMapper extends CommonBaseMapper<Purchase>{
 
     String validateBatchUnAudit(List<DocBaseDTO> baseDTOs);
 
-    Integer validateCodeWhenInsert(String code);
+    Integer validateCodeWhenInsert(@Param("code") String code, @Param("companyId") Long companyId);
 
-    Integer validateCodeWhenUpdate(@Param("code") String code,@Param("id") Long id);
+    Integer validateCodeWhenUpdate(@Param("code") String code, @Param("id") Long id,
+                                   @Param("companyId") Long companyId);
 
     String selectCodeById(Long id);
 }

+ 2 - 1
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/ProdInOutService.java

@@ -4,6 +4,7 @@ import com.github.pagehelper.PageInfo;
 import com.usoftchina.saas.base.Result;
 import com.usoftchina.saas.base.service.CommonBaseService;
 import com.usoftchina.saas.commons.dto.BatchDealBaseDTO;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.commons.dto.DocSavedDTO;
 import com.usoftchina.saas.page.PageRequest;
 import com.usoftchina.saas.purchase.dto.ProdInOutFormDTO;
@@ -32,7 +33,7 @@ public interface ProdInOutService extends CommonBaseService<ProdInOutMapper, Pro
      * @param formdata
      * @return
      */
-    DocSavedDTO saveFormData(ProdInOutFormDTO formdata,Boolean isbfaudit);
+    DocBaseDTO saveFormData(ProdInOutFormDTO formdata);
 
     /**
      * 删除出入库单

+ 3 - 2
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/ProdInOutServiceImpl.java

@@ -339,8 +339,9 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         if (null == code) {
             throw new BizException(BizExceptionCode.NULL_CODE);
         }
-        Integer count = "0".equals(String.valueOf(id)) ? purchaseMapper.validateCodeWhenInsert(code) :
-                purchaseMapper.validateCodeWhenUpdate(code, id);
+        Long companyId = BaseContextHolder.getCompanyId();
+        Integer count = "0".equals(String.valueOf(id)) ? purchaseMapper.validateCodeWhenInsert(code, companyId) :
+                purchaseMapper.validateCodeWhenUpdate(code, id, companyId);
         return maxnumberService.pushMaxnubmer(count, code, "Purchase").toString();
     }
 

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

@@ -10,6 +10,7 @@ import com.usoftchina.saas.commons.dto.BatchDealBaseDTO;
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.commons.dto.ListReqDTO;
 import com.usoftchina.saas.commons.exception.BizExceptionCode;
+import com.usoftchina.saas.commons.po.BillCodeSeq;
 import com.usoftchina.saas.commons.po.Status;
 import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.exception.BizException;
@@ -469,9 +470,10 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
         if (null == code) {
             throw new BizException(BizExceptionCode.NULL_CODE);
         }
-        Integer count = "0".equals(String.valueOf(id)) ? purchaseMapper.validateCodeWhenInsert(code) :
-                purchaseMapper.validateCodeWhenUpdate(code, id);
-        return maxnumberService.pushMaxnubmer(count, code, "Purchase").getData();
+        Long companyId = BaseContextHolder.getCompanyId();
+        Integer count = "0".equals(String.valueOf(id)) ? purchaseMapper.validateCodeWhenInsert(code, companyId) :
+                purchaseMapper.validateCodeWhenUpdate(code, id, companyId);
+        return maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.PURCHASE.getCaller()).getData();
     }
     
     /** 
@@ -486,7 +488,7 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
             return null;
         }
         String code = purchaseMapper.selectCodeById(id);
-        DocBaseDTO baseDTO = new DocBaseDTO(id, code, "Purchase");
+        DocBaseDTO baseDTO = new DocBaseDTO(id, code, BillCodeSeq.PURCHASE.getCaller());
         return baseDTO;
     }
 }

+ 6 - 6
applications/purchase/purchase-server/src/main/resources/mapper/PurchaseMapper.xml

@@ -406,20 +406,20 @@
   <select id="validateUnAudit" parameterType="long" resultType="java.lang.String">
     select pu_code from purchase where pu_id = #{pu_id} and IFNULL(pu_statuscode,'UNAUDITED')='UNAUDITED'
   </select>
-  <select id="selectByTest" resultMap="BaseResultMap" parameterType="string" >
+  <!--<select id="selectByTest" resultMap="BaseResultMap" parameterType="string" >
     select * from purchase <where>
     <if test="_parameter != null">
        ${value}
     </if>
   </where>
-  </select>
-  <select id="validateCodeWhenInsert" resultType="int" parameterType="string" >
-    select count(1) from purchase where pu_code = #{code}
+  </select>-->
+  <select id="validateCodeWhenInsert" resultType="int">
+    select count(1) from purchase where pu_code = #{code} and companyId =#{companyId}
   </select>
   <select id="validateCodeWhenUpdate" resultType="int" >
-    select count(1) from purchase where pu_code = #{code} and pu_id != #{id}
+    select count(1) from purchase where pu_code = #{code} and pu_id != #{id} and companyId =#{companyId}
   </select>
   <select id="selectCodeById" resultType="string" parameterType="long">
-    select pu_code from pu_id=#{id}
+    select pu_code from purchase where pu_id=#{id}
   </select>
 </mapper>

+ 9 - 1
applications/sale/sale-dto/pom.xml

@@ -19,6 +19,14 @@
             <groupId>com.usoftchina.saas</groupId>
             <artifactId>core</artifactId>
         </dependency>
+        <dependency>
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-swagger2</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.usoftchina.saas</groupId>
+            <artifactId>document-dto</artifactId>
+        </dependency>
     </dependencies>
-
 </project>

+ 91 - 0
applications/sale/sale-dto/src/main/java/com/usoftchina/saas/sale/dto/ProdIODetailDTO.java

@@ -0,0 +1,91 @@
+package com.usoftchina.saas.sale.dto;
+
+import com.usoftchina.saas.base.entity.CommonBaseEntity;
+
+import com.usoftchina.saas.document.dto.ProductDTO;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * Created by wyx
+ * 2018-10-23
+ */
+@Data
+public class ProdIODetailDTO 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 Long 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 product;
+
+}

+ 73 - 0
applications/sale/sale-dto/src/main/java/com/usoftchina/saas/sale/dto/ProdInOutDTO.java

@@ -0,0 +1,73 @@
+package com.usoftchina.saas.sale.dto;
+
+import com.usoftchina.saas.base.entity.CommonBaseEntity;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * Created by wyx
+ * 2018-10-23
+ */
+@Data
+public class ProdInOutDTO 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 Long pi_said;
+
+    private String pi_sacode;
+
+    private Double pi_total;
+
+    private Integer 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;
+
+
+
+}

+ 18 - 0
applications/sale/sale-dto/src/main/java/com/usoftchina/saas/sale/dto/ProdInOutFormDTO.java

@@ -0,0 +1,18 @@
+package com.usoftchina.saas.sale.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Created by wyx
+ * 2018-10-23
+ */
+@Data
+public class ProdInOutFormDTO implements Serializable {
+
+    private ProdInOutDTO main;
+    private List<ProdIODetailDTO> items;
+
+}

+ 140 - 0
applications/sale/sale-dto/src/main/java/com/usoftchina/saas/sale/dto/ProdInOutListDTO.java

@@ -0,0 +1,140 @@
+package com.usoftchina.saas.sale.dto;
+
+import com.usoftchina.saas.base.entity.CommonBaseEntity;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * Created by wyx
+ * 2018-10-23
+ */
+@Data
+public class ProdInOutListDTO 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 Integer 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 Long pd_piid;
+
+    private String pd_inoutno;
+
+    private String pd_piclass;
+
+    private Integer pd_pdno;
+
+    private String pd_ordercode;
+
+    private Integer pd_orderdetno;
+
+    private Integer 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 Integer pd_yqty;
+
+    private String pd_remark;
+
+}

+ 28 - 0
applications/sale/sale-dto/src/main/java/com/usoftchina/saas/sale/dto/ProdInOutReqDTO.java

@@ -0,0 +1,28 @@
+package com.usoftchina.saas.sale.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * Created by wyx
+ * 2018-10-23
+ */
+@Data
+public class ProdInOutReqDTO implements Serializable {
+    /**
+     * 开始日期
+     */
+    private Date begin;
+    /**
+     * 截止日期
+     */
+    private Date end;
+    private String status;
+    private String keyword;
+    //区分是否为关联列表
+    private String mode;
+
+
+}

+ 1 - 2
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/SaleApplication.java

@@ -14,13 +14,12 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
 @SpringBootApplication
 @MapperScan("com.usoftchina.saas.sale.mapper")
 @EnableEurekaClient
-public class SaleApplication extends WebMvcConfigurerAdapter {
+public class SaleApplication extends WebMvcConfigurerAdapter{
     public static void main(String[] args) {
         SpringApplication.run(SaleApplication.class, args);
     }
     @Override
     public void addCorsMappings(CorsRegistry registry) {
-
         registry.addMapping("/**")
                 .allowCredentials(true)
                 .allowedHeaders("*")

+ 161 - 0
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/controller/ProdInOutController.java

@@ -0,0 +1,161 @@
+package com.usoftchina.saas.sale.controller;
+
+import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.commons.dto.BatchDealBaseDTO;
+import com.usoftchina.saas.commons.dto.DocSavedDTO;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.page.PageRequest;
+import com.usoftchina.saas.sale.dto.ProdInOutFormDTO;
+import com.usoftchina.saas.sale.dto.ProdInOutReqDTO;
+import com.usoftchina.saas.sale.service.ProdInOutService;
+import com.usoftchina.saas.storage.po.ProdInOutList;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * Created by wyx
+ * 2018-10-23.
+ */
+@CrossOrigin
+@RestController
+@RequestMapping("/prodinout")
+public class ProdInOutController {
+
+
+    @Autowired
+    ProdInOutService prodInOutService;
+
+
+    /**
+     * 出入库订单列表
+     *
+     * @param page
+     * @param req
+     * @return
+     */
+    @GetMapping("/list")
+    public Result<PageInfo<ProdInOutList>> getListData(PageRequest page, ListReqDTO req) {
+        PageInfo<ProdInOutList> listData = prodInOutService.getListData(page,req);
+        return Result.success(listData);
+    }
+
+    /**
+     * 获取出入库单表单
+     *
+     * @return
+     */
+    @GetMapping("/read/{id}")
+    public Result<ProdInOutFormDTO> getFormData(@PathVariable("id") Long id) {
+        ProdInOutFormDTO data = prodInOutService.getFormData(id);
+        return Result.success(data);
+    }
+
+    /**
+     * 出入库单表单保存
+     *
+     * @param
+     * @return
+     */
+    @PostMapping("/save")
+    public Result<DocSavedDTO> saveFormData(@RequestBody ProdInOutFormDTO data) {
+        DocSavedDTO savedDTO = prodInOutService.saveFormData(data,false);
+        return Result.success(savedDTO);
+    }
+
+    /**
+     * 出入库单删除
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping("/delete/{id}")
+    public Result delete(@PathVariable("id") Long id) {
+        prodInOutService.delete(id);
+        return Result.success();
+    }
+
+    /**
+     * 出入库单明细删除
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping("/deleteItem/{id}")
+    public Result deleteItem(@PathVariable("id") Long id) {
+        prodInOutService.deleteItem(id);
+        return Result.success();
+    }
+
+
+    /**
+     * 出入库单审批
+     *
+     * @param formData
+     * @return
+     */
+    @PostMapping("/audit")
+    public Result audit(@RequestBody ProdInOutFormDTO formData) {
+        DocSavedDTO audit = prodInOutService.audit(formData);
+        return Result.success(audit);
+    }
+
+    /**
+     * 出入库单审批
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping("/unAudit/{id}")
+    public Result unAudit(@PathVariable("id") Long id) {
+        prodInOutService.unAudit(id);
+        return Result.success();
+    }
+
+    /**
+     * 出入库单批量审核/反审核
+     *
+     * @param baseDTOs
+     * @return
+     */
+    @PostMapping("/batchAudit")
+    public Result batchAudit(@RequestBody BatchDealBaseDTO baseDTOs) {
+        prodInOutService.batchAudit(baseDTOs);
+        return Result.success();
+    }
+
+    /**
+     * 出入库单批量反审核
+     *
+     * @param baseDTOs
+     * @return
+     */
+    @PostMapping("/batchUnAudit")
+    public Result batchUnAudit(@RequestBody BatchDealBaseDTO baseDTOs) {
+        prodInOutService.batchAudit(baseDTOs);
+        return Result.success();
+    }
+
+
+    /**
+     * 出入库单批量删除
+     *
+     * @param baseDTOs
+     * @return
+     */
+    @PostMapping("/batchDelete")
+    public Result batchDelete(@RequestBody BatchDealBaseDTO baseDTOs) {
+        prodInOutService.batchDelete(baseDTOs);
+        return Result.success();
+    }
+
+    @GetMapping("/turnProdIn/{id}")
+    public Result turnProdin(@PathVariable("id") Long id){
+        prodInOutService.turnProdin(id);
+        return Result.success();
+    };
+
+
+
+
+}

+ 4 - 4
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/controller/SaleController.java

@@ -67,7 +67,7 @@ public class SaleController {
      * @param id
      * @return
      */
-    @GetMapping("/delete/{id}")
+    @PostMapping("/delete/{id}")
     public Result delete(@PathVariable("id") Long id) {
         saleService.delete(id);
         return Result.success();
@@ -79,7 +79,7 @@ public class SaleController {
      * @param id
      * @return
      */
-    @GetMapping("/deleteDetail/{id}")
+    @PostMapping("/deleteDetail/{id}")
     public Result deleteDetail(@PathVariable("id") Long id) {
         saleService.deleteDetail(id);
         return Result.success();
@@ -103,7 +103,7 @@ public class SaleController {
      * @param id
      * @return
      */
-    @GetMapping("/unAudit/{id}")
+    @PostMapping("/unAudit/{id}")
     public Result unAudit(@PathVariable("id") Long id) {
         saleService.unAudit(id);
         return Result.success();
@@ -157,7 +157,7 @@ public class SaleController {
         return Result.success();
     }
 
-    @GetMapping("/turnProdOut/{id}")
+    @PostMapping("/turnProdOut/{id}")
     public Result turnOut(@PathVariable("id") Long id) {
         saleService.turnOut(id);
         return Result.success();

+ 18 - 7
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/ProdIODetailMapper.java

@@ -1,30 +1,41 @@
 package com.usoftchina.saas.sale.mapper;
 
+import com.usoftchina.saas.base.mapper.CommonBaseMapper;
 import com.usoftchina.saas.storage.po.ProdIODetail;
+import com.usoftchina.saas.storage.po.ProdIODetailExample;
+
 
 import java.util.List;
 
-public interface ProdIODetailMapper  {
+public interface ProdIODetailMapper extends CommonBaseMapper<ProdIODetail> {
+
 
-    int deleteByPrimaryKey(Long pd_id);
+    int deleteByExample(ProdIODetailExample example);
 
     int insert(ProdIODetail record);
 
     int insertSelective(ProdIODetail record);
 
-    ProdIODetail selectByPrimaryKey(Integer pd_id);
-
     int updateByPrimaryKeySelective(ProdIODetail record);
 
-    int updateByPrimaryKeyWithBLOBs(ProdIODetail record);
-
     int updateByPrimaryKey(ProdIODetail record);
 
+    int deleteByPrimaryKey(Long id);
+
+    void deleteByForeignKey(Long id);
+
     void batchInsert(List<ProdIODetail> list);
 
     void batchUpdate(List<ProdIODetail> list);
 
-    void updatePurchaseYqty(Integer id);
+    void updateSaleOutYqty(Long id);
 
     List<ProdIODetail> selectByFK(Long id);
+    //销售入库更新计算明细其它字段
+    void updatePDSaleIN(Long id);
+    //销售出库更新计算明细其它字段
+    void updatePDSaleOut(Long id);
+    //更新销售订单已转数
+    void updateSaleYqty(Long id);
+
 }

+ 20 - 0
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/ProdInOutListMapper.java

@@ -0,0 +1,20 @@
+package com.usoftchina.saas.sale.mapper;
+
+import com.usoftchina.saas.sale.dto.ProdInOutReqDTO;
+import com.usoftchina.saas.storage.po.ProdInOutList;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * Created by wyx
+ * 2018-10-23.
+ */
+public interface ProdInOutListMapper {
+
+    List<ProdInOutList> selectProdInOutListByCondition(@Param("con") String con, @Param("companyId") Long companyId);
+
+    List<ProdInOutList> selectProdInOutBycondition(@Param("con") String con, @Param("companyId") Long companyId);
+
+
+}

+ 32 - 1
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/ProdInOutMapper.java

@@ -1,10 +1,19 @@
 package com.usoftchina.saas.sale.mapper;
 
+import com.usoftchina.saas.base.mapper.CommonBaseMapper;
+
+import com.usoftchina.saas.commons.dto.BatchDealBaseDTO;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.storage.po.ProdInOut;
+import com.usoftchina.saas.storage.po.ProdInOutExample;
+import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
 
+public interface ProdInOutMapper extends CommonBaseMapper<ProdInOut> {
+    long countByExample(ProdInOutExample example);
 
-public interface ProdInOutMapper {
+    int deleteByExample(ProdInOutExample example);
 
     int deleteByPrimaryKey(Long pi_id);
 
@@ -12,11 +21,33 @@ public interface ProdInOutMapper {
 
     int insertSelective(ProdInOut record);
 
+    List<ProdInOut> selectByExampleWithBLOBs(ProdInOutExample example);
+
+    List<ProdInOut> selectByExample(ProdInOutExample example);
+
     ProdInOut selectByPrimaryKey(Long pi_id);
 
+    int updateByExampleSelective(@Param("record") ProdInOut record, @Param("example") ProdInOutExample example);
+
+    int updateByExampleWithBLOBs(@Param("record") ProdInOut record, @Param("example") ProdInOutExample example);
+
+    int updateByExample(@Param("record") ProdInOut record, @Param("example") ProdInOutExample example);
+
     int updateByPrimaryKeySelective(ProdInOut record);
 
     int updateByPrimaryKeyWithBLOBs(ProdInOut record);
 
     int updateByPrimaryKey(ProdInOut record);
+
+    String selectCodeById(Long pi_id);
+
+    int validateCodeWhenInsert(@Param("code") String code,@Param("pi_class") String pi_class );
+
+    int validateCodeWhenUpdate(@Param("code") String code,@Param("id") Long id );
+
+    String validateUnAudit(Long id);
+
+    String validateAudit(List<DocBaseDTO> baseDTOs);
+
+    String validateBatchUnAudit(List<DocBaseDTO> baseDTOs);
 }

+ 2 - 2
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/SaleMapper.java

@@ -20,7 +20,7 @@ public interface SaleMapper {
 
     int updateByPrimaryKey(Sale record);
 
-    Integer validateCodeWhenInsert(String code);
+    Integer validateCodeWhenInsert(@Param("code") String code, @Param("companyId") Long companyId);
 
     String selectCodeById(Long id);
 
@@ -30,7 +30,7 @@ public interface SaleMapper {
 
     String validateAudit(List<DocBaseDTO> baseDTOs);
 
-    Integer validateCodeWhenUpdate(@Param("code") String code,@Param("id") Long id);
+    Integer validateCodeWhenUpdate(@Param("code") String code, @Param("id") Long id, @Param("companyId") Long companyId);
 
     void updateTotal(Long id);
 }

+ 76 - 0
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/ProdInOutService.java

@@ -0,0 +1,76 @@
+package com.usoftchina.saas.sale.service;
+
+import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.base.service.CommonBaseService;
+import com.usoftchina.saas.commons.dto.BatchDealBaseDTO;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.commons.dto.DocSavedDTO;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.page.PageRequest;
+
+import com.usoftchina.saas.sale.dto.ProdInOutFormDTO;
+import com.usoftchina.saas.sale.dto.ProdInOutReqDTO;
+import com.usoftchina.saas.sale.mapper.ProdInOutMapper;
+import com.usoftchina.saas.storage.po.ProdInOut;
+import com.usoftchina.saas.storage.po.ProdInOutList;
+
+
+/**
+ * Created by wyx
+ * 2018-10-23.
+ */
+public interface ProdInOutService extends CommonBaseService<ProdInOutMapper, ProdInOut>  {
+
+
+    /**
+     * 获取出入单表单
+     *
+     * @param id
+     * @return
+     */
+    ProdInOutFormDTO getFormData(Long id);
+
+    /**
+     * 保存出入库单
+     *
+     * @param formdata
+     * @return
+     */
+    DocBaseDTO saveFormData(ProdInOutFormDTO formdata);
+
+    /**
+     * 删除出入库单
+     * @param id
+     */
+    void delete(Long id);
+
+    /**
+     * 审核出入库单
+     * @param formData
+     * @return
+     */
+    DocBaseDTO audit(ProdInOutFormDTO formData);
+
+    /**
+     * 反审核出入库单
+     * @param id
+     */
+    Result unAudit(Long id);
+
+    void batchAudit(BatchDealBaseDTO baseDTOs);
+
+    Integer deleteItem(Long id);
+
+    void batchDelete(BatchDealBaseDTO baseDTOs);
+
+    PageInfo<ProdInOutList> getListData(PageRequest page, ListReqDTO req);
+
+    Result turnProdin(Long id);
+
+    void batchUnAudit(BatchDealBaseDTO baseDTOs);
+
+    void open(Long id);
+
+    void close(Long id);
+}

+ 584 - 0
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/ProdInOutServiceImpl.java

@@ -0,0 +1,584 @@
+package com.usoftchina.saas.sale.service.impl;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
+import com.usoftchina.saas.commons.api.MaxnumberService;
+import com.usoftchina.saas.commons.api.MessageLogService;
+import com.usoftchina.saas.commons.dto.BatchDealBaseDTO;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.commons.dto.DocSavedDTO;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.commons.exception.BizExceptionCode;
+import com.usoftchina.saas.commons.po.BillCodeSeq;
+import com.usoftchina.saas.commons.po.Maxnumbers;
+import com.usoftchina.saas.commons.po.Status;
+import com.usoftchina.saas.context.BaseContextHolder;
+import com.usoftchina.saas.document.api.WarehouseApi;
+import com.usoftchina.saas.exception.BizException;
+import com.usoftchina.saas.exception.ExceptionCode;
+import com.usoftchina.saas.page.PageRequest;
+import com.usoftchina.saas.sale.dto.ProdIODetailDTO;
+import com.usoftchina.saas.sale.dto.ProdInOutDTO;
+import com.usoftchina.saas.sale.dto.ProdInOutFormDTO;
+import com.usoftchina.saas.sale.dto.ProdInOutReqDTO;
+import com.usoftchina.saas.sale.mapper.*;
+import com.usoftchina.saas.sale.service.ProdInOutService;
+import com.usoftchina.saas.storage.po.ProdIODetail;
+import com.usoftchina.saas.storage.po.ProdInOut;
+import com.usoftchina.saas.storage.po.ProdInOutList;
+import com.usoftchina.saas.utils.BeanMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.StringUtils;
+
+import java.util.*;
+@Service
+public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper, ProdInOut> implements ProdInOutService{
+
+    @Autowired
+    private MaxnumberService maxnumberService;
+
+    @Autowired
+    private ProdInOutListMapper prodInOutListMapper;
+    @Autowired
+    private ProdInOutMapper prodInOutMapper;
+    @Autowired
+    private ProdIODetailMapper prodIODetailMapper;
+    @Autowired
+    private MessageLogService messageLogService;
+    @Autowired
+    private WarehouseApi warehouseApi;
+
+    @Override
+    public ProdInOutFormDTO getFormData(Long id) {
+        ProdInOutFormDTO prodInOutFormDTO = new ProdInOutFormDTO();
+        //查询主表
+        ProdInOut prodInOut = getMapper().selectByPrimaryKey(id);
+        //将prodInOut实体对象转化为传输对象
+        ProdInOutDTO main = BeanMapper.map(prodInOut,ProdInOutDTO.class);
+        //查询从表
+
+        List<ProdIODetail> prodIODetails = prodIODetailMapper.selectByFK(id);
+        List<ProdIODetailDTO> items = BeanMapper.mapList(prodIODetails,ProdIODetailDTO.class);
+        prodInOutFormDTO.setMain(main);
+        prodInOutFormDTO.setItems(items);
+        return prodInOutFormDTO;
+    }
+
+    @Override
+    @Transactional
+    public DocBaseDTO saveFormData(ProdInOutFormDTO formdata) {
+
+        if (null == formdata || null == formdata.getMain()){
+            throw new BizException(500, "数据为空,请填写后再保存");
+        }
+        //公司ID
+        Long companyId = BaseContextHolder.getCompanyId();
+        //人员Id
+        Long userId = BaseContextHolder.getUserId();
+        //获取主表信息
+        ProdInOutDTO main = formdata.getMain();
+        List<ProdIODetailDTO> items = formdata.getItems();
+        //插入从表数据
+        List<ProdIODetail> insertDetails = new ArrayList<>();
+        //更新从表数据
+        List<ProdIODetail> updateDetails = new ArrayList<>();
+        //返回对象
+        DocBaseDTO baseDTO = new DocBaseDTO();
+        Long pi_id = main.getId();
+        String pi_inoutno = main.getPi_inoutno();
+        String pi_class = main.getPi_class();
+        ProdInOut prodInOut = BeanMapper.map(main,ProdInOut.class);
+        prodInOut.setCompanyId(companyId);
+        prodInOut.setCreatorId(userId);
+        prodInOut.setCreateTime(new Date());
+        prodInOut.setPi_date(new Date());
+
+        //编号获取
+        pi_inoutno = pushMaxnubmer(pi_inoutno, pi_id,pi_class);
+        prodInOut.setPi_inoutno(pi_inoutno);
+
+        prodInOut.setPi_class(main.getPi_class());
+        prodInOut.setPi_said(main.getPi_said());
+        prodInOut.setPi_sacode(main.getPi_sacode());
+
+        //判断更新与保存动作
+        if (StringUtils.isEmpty(pi_id) || "0".equals(pi_id.toString())){
+            //插入操作
+            prodInOutMapper.insertSelective(prodInOut);
+            pi_id = prodInOut.getId();
+            //添加从表传输对象
+            for (ProdIODetailDTO item : items) {
+                ProdIODetail detail = BeanMapper.map(item,ProdIODetail.class);
+                detail.setPd_piid(pi_id);
+                detail.setPd_inoutno(pi_inoutno);
+                detail.setPd_piclass(pi_class);
+                detail.setPd_yqty(0.0);
+                insertDetails.add(detail);
+            }
+
+            //插入从表
+            if (insertDetails.size()>0) {
+                prodIODetailMapper.batchInsert(insertDetails);
+            }
+            baseDTO = getBaseDTOById(pi_id,pi_class);
+            //更新明细金额
+            getTotal(pi_id,pi_class);
+            //日志记录
+            messageLogService.save(baseDTO);
+            return baseDTO;
+        }
+        //更新操作
+        prodInOutMapper.updateByPrimaryKeySelective(prodInOut);
+        //添加从表传输对象
+        for (ProdIODetailDTO item : items) {
+            ProdIODetail detail = BeanMapper.map(item, ProdIODetail.class);
+            detail.setPd_piid(pi_id);
+            detail.setPd_inoutno(pi_inoutno);
+            detail.setPd_piclass(prodInOut.getPi_class());
+            if (StringUtils.isEmpty(detail.getId()) || "0".equals(detail.getId().toString())) {
+                insertDetails.add(detail);
+            } else {
+                updateDetails.add(detail);
+            }
+        }
+        //插入从表
+        if (insertDetails.size()>0) {
+            prodIODetailMapper.batchInsert(insertDetails);
+        }
+        //更新从表
+        if (updateDetails.size()>0) {
+            prodIODetailMapper.batchUpdate(updateDetails);
+        }
+        baseDTO = getBaseDTOById(pi_id,pi_class);
+        //更新已转数
+        updateYqty(prodInOut);
+        return baseDTO;
+
+    }
+
+    @Override
+    @Transactional
+    public void delete(Long id) {
+        singleDelete(id);
+    }
+    private void singleDelete(Long id) {
+        ProdInOut prodInOut = getMapper().selectByPrimaryKey(id);
+        //从表删除
+        prodIODetailMapper.deleteByForeignKey(id);
+        //主表删除
+        prodInOutMapper.deleteByPrimaryKey(id);
+        DocBaseDTO docBaseDTO = getBaseDTOById(id,prodInOut.getPi_class());
+        //更新已转数
+        updateYqty(prodInOut);
+        //日志
+        messageLogService.deleteDetail(docBaseDTO);
+    }
+    @Override
+    @Transactional
+    public DocBaseDTO audit(ProdInOutFormDTO formData) {
+        Long id = null;
+        DocBaseDTO baseDTO = new DocBaseDTO();
+        if (null != formData) {
+            id = formData.getMain().getId();
+            if (StringUtils.isEmpty(id)) {
+                baseDTO = saveFormData(formData);
+                id = baseDTO.getId();
+            }
+            String res = singleAudit(formData.getMain());
+            if(res!=null){
+                new BizException(501,res);
+            }
+        }
+        baseDTO.setId(id);
+        return baseDTO;
+    }
+    private String singleAudit(ProdInOutDTO prodInOutDTO) {
+        String pi_class= prodInOutDTO.getPi_class();
+        Map<String, Object> map = new HashMap<String, Object>();
+        map.put("inoutNo",prodInOutDTO.getPi_inoutno() );
+        map.put("class", pi_class);
+        map.put("commitid",BaseContextHolder.getUserId());
+        map.put("companyid",BaseContextHolder.getCompanyId());
+        map.put("result","");
+        warehouseApi.post(map);
+        Object result =  map.get("result");
+        if(result!=null){
+            return result.toString();
+        }else{
+            //记录日志
+            DocBaseDTO docBaseDTO = getBaseDTOById(prodInOutDTO.getId(),pi_class);
+            //日志
+            messageLogService.audit(docBaseDTO);
+            return "";
+        }
+    }
+    @Override
+    public Result unAudit(Long id) {
+        if (null == id) {
+            return Result.error(BizExceptionCode.SALE_NULL_BILL);
+        }
+        String code = prodInOutMapper.validateUnAudit(id);
+        if (null != code) {
+            throw new BizException(BizExceptionCode.SALE_NULL_BILL);
+        }
+        ProdInOut prodInOut = prodInOutMapper.selectByPrimaryKey(id);
+        ProdInOutDTO prodInOutDTO = BeanMapper.map(prodInOut, ProdInOutDTO.class);
+        String res =  singleUnAudit(prodInOutDTO);
+        if(res!=null){
+            return Result.error(res);
+        }else{
+            return Result.success();
+        }
+    }
+    private String singleUnAudit(ProdInOutDTO prodInOutDTO) {
+        String pi_class= prodInOutDTO.getPi_class();
+        Map<String, Object> map = new HashMap<String, Object>();
+        map.put("inoutNo",prodInOutDTO.getPi_inoutno() );
+        map.put("class", pi_class);
+        map.put("commitid",BaseContextHolder.getUserId());
+        map.put("companyid",BaseContextHolder.getCompanyId());
+        map.put("result","");
+        warehouseApi.unPost(map);
+        Object result =  map.get("result");
+        if(result!=null){
+            return result.toString();
+        }else{
+            //记录日志
+            DocBaseDTO docBaseDTO = getBaseDTOById(prodInOutDTO.getId(),pi_class);
+            //日志
+            messageLogService.unAudit(docBaseDTO);
+            return "";
+        }
+    }
+    @Override
+    public void batchAudit(BatchDealBaseDTO baseDTOs) {
+        if (null == baseDTOs || null == baseDTOs.getBaseDTOs() ||
+                baseDTOs.getBaseDTOs().size() == 0) {
+            return;
+        }
+        String validate = prodInOutMapper.validateAudit(baseDTOs.getBaseDTOs());
+        if (!StringUtils.isEmpty(validate)) {
+            throw new BizException(500, "存在已审核单据,单据编号:" + validate);
+        }
+        String error = null;
+        for (DocBaseDTO base : baseDTOs.getBaseDTOs()) {
+            Long id =  base.getId();
+            ProdInOut prodInOut = prodInOutMapper.selectByPrimaryKey(id);
+            ProdInOutDTO prodInOutDTO = BeanMapper.map(prodInOut,ProdInOutDTO.class);
+            error+=singleAudit(prodInOutDTO);
+        }
+        if(error!=null&&!error.equals("")){
+            new BizException(501,error);
+        }
+    }
+
+    @Override
+    public void batchUnAudit(BatchDealBaseDTO baseDTOs) {
+        if (null == baseDTOs || null == baseDTOs.getBaseDTOs() ||
+                baseDTOs.getBaseDTOs().size() == 0) {
+            return;
+        }
+
+        String msg = prodInOutMapper.validateBatchUnAudit(baseDTOs.getBaseDTOs());
+        if (null != msg) {
+            throw new BizException(500, "存在未审核单据,单据编号:" + msg);
+        }
+        String error = null;
+        for (DocBaseDTO base : baseDTOs.getBaseDTOs()) {
+            Long id =  base.getId();
+            ProdInOut prodInOut = prodInOutMapper.selectByPrimaryKey(id);
+            ProdInOutDTO prodInOutDTO = BeanMapper.map(prodInOut,ProdInOutDTO.class);
+            error+=singleUnAudit(prodInOutDTO);
+        }
+        if(error!=null&&!error.equals("")){
+            new BizException(501,error);
+        }
+    }
+
+    @Override
+    public Integer deleteItem(Long id) {
+        ProdIODetail prodIODetail = prodIODetailMapper.selectByPrimaryKey(id);
+        ProdInOut prodInOut = prodInOutMapper.selectByPrimaryKey(prodIODetail.getPd_piid());
+        Integer num = prodIODetailMapper.deleteByPrimaryKey(id);
+        //更新已转数
+        updateYqty(prodInOut);
+        DocBaseDTO docBaseDTO = getBaseDTOById(id,prodInOut.getPi_class());
+        //日志
+        messageLogService.deleteDetail(docBaseDTO);
+        return num;
+    }
+    @Override
+    public void batchDelete(BatchDealBaseDTO baseDTOs) {
+        if (null == baseDTOs || null == baseDTOs.getBaseDTOs() ||
+                baseDTOs.getBaseDTOs().size() == 0) {
+            return;
+        }
+        for (DocBaseDTO base : baseDTOs.getBaseDTOs()) {
+            singleDelete(base.getId());
+        }
+    }
+
+    @Override
+    public PageInfo<ProdInOutList> getListData(PageRequest page, ListReqDTO req) {
+        //设置默认分页
+        if (null == page || page.getSize() == 0 || page.getNumber() == 0) {
+            page = new PageRequest();
+            page.setNumber(1);
+            page.setSize(10);
+        }
+        PageHelper.startPage(page.getNumber(), page.getSize());
+        //查询数据
+        List<ProdInOutList> lists = getListByMode(req);
+        //取分页信息
+        PageInfo<ProdInOutList> pageInfo = new PageInfo<ProdInOutList>(lists);
+        return pageInfo;
+    }
+    private List<ProdInOutList> getListByMode(ListReqDTO req) {
+        List<ProdInOutList> list = null;
+        Long companyId = BaseContextHolder.getCompanyId();
+        String con = req.getFinalCondition();
+        if (null == con) {
+            con = "1=1";
+        }
+        if (null == req || StringUtils.isEmpty(req.getMode()) || "Main".equals(req.getMode())) {
+            list = prodInOutListMapper.selectProdInOutListByCondition(con, companyId);
+        } else {
+            list = prodInOutListMapper.selectProdInOutBycondition(con, companyId);
+        }
+        return list;
+    }
+    @Override
+    public Result turnProdin(Long id) {
+        Integer count=0;
+        double pdOutqty=0;
+        double pdYqty=0;
+        ProdInOut sourcePi = prodInOutMapper.selectByPrimaryKey(id);
+        List<ProdIODetail> sourceDetails =prodIODetailMapper.selectByFK(id);
+        if (null == sourcePi || StringUtils.isEmpty(sourcePi.getPi_inoutno()) || sourceDetails.size() == 0) {
+            throw new BizException(BizExceptionCode.SALE_NULL_BILL);
+        }
+
+        //检查转单状态
+        String statuscode = sourcePi.getPi_statuscode();
+        if(!Status.UNAUDITED.name().equals(statuscode)){
+            throw new BizException(BizExceptionCode.SALEOUT_POSTSTATUS_ERROR);
+        }
+
+        //检查从表
+        for (ProdIODetail prodIODetail : sourceDetails) {
+            pdOutqty = prodIODetail.getPd_outqty()==null?0.0:prodIODetail.getPd_outqty();
+            pdYqty = prodIODetail.getPd_yqty()==null?0.0:prodIODetail.getPd_yqty();
+            if (pdOutqty-pdYqty>0){
+                count++;
+            }
+        }
+        //判断可转数
+        if (count==0) {
+            return Result.error(ExceptionCode.TURNINNUM_NOT_EXIST);
+        }
+        //插入销售退货单主表
+        ProdInOut targetPi = new ProdInOut();
+        //生成单号
+        String piInoutno =  maxnumberService.getMaxnumber(BillCodeSeq.SALEIN.getCaller(),true).getData();
+        targetPi.setPi_inoutno(piInoutno);
+        targetPi.setPi_class(BillCodeSeq.SALEIN.getName());
+        targetPi.setPi_date(new Date());
+        targetPi.setPi_recorddate(new Date());
+        targetPi.setPi_status(Status.UNAUDITED.getDisplay());
+        targetPi.setPi_statuscode(Status.UNAUDITED.name());
+        //客户信息
+        targetPi.setPi_custid(sourcePi.getPi_custid());
+        targetPi.setPi_custcode(sourcePi.getPi_custcode());
+        targetPi.setPi_custname(sourcePi.getPi_custname());
+        targetPi.setPi_said(sourcePi.getPi_said());
+        targetPi.setPi_sacode(sourcePi.getPi_sacode());
+
+        //设置公司id
+        targetPi.setCompanyId(sourcePi.getCompanyId());
+        //保存数据
+        getMapper().insertSelective(targetPi);
+        //插入销售退货单从表
+        long pi_id = targetPi.getId();
+        for (int i = 0;i<sourceDetails.size();i++){
+            ProdIODetail sourcePid = sourceDetails.get(i);
+            ProdIODetail targetPid = new ProdIODetail();
+            pdOutqty = sourcePid.getPd_outqty()==null?0.0:sourcePid.getPd_outqty();
+            pdYqty = sourcePid.getPd_yqty()==null?0.0:sourcePid.getPd_yqty();
+            if(pdOutqty-pdYqty>0){
+                targetPid.setPd_piid(pi_id);
+                targetPid.setPd_inoutno(piInoutno);
+                targetPid.setPd_piclass(BillCodeSeq.SALEIN.getName());
+                targetPid.setPd_pdno(i);
+                targetPid.setPd_orderid(sourcePid.getPd_orderid());
+                targetPid.setPd_ordercode(sourcePid.getPd_ordercode());
+                targetPid.setPd_orderdetno(sourcePid.getPd_orderdetno());
+
+                targetPid.setPd_sdid(sourcePid.getPd_sdid());
+                targetPid.setPd_sendprice(sourcePid.getPd_sendprice());
+
+
+                targetPid.setPd_prodid(sourcePid.getPd_prodid());
+                targetPid.setPd_prodcode(sourcePid.getPd_prodcode());
+                targetPid.setPd_unit(sourcePid.getPd_unit());
+                targetPid.setPd_ioid(sourcePid.getId());
+                targetPid.setPd_status(0);
+                //公司id
+                targetPid.setCompanyId(sourcePid.getCompanyId());
+                //本次转单数
+                targetPid.setPd_inqty(pdOutqty-pdYqty);
+                prodIODetailMapper.insertSelective(targetPid);
+                //更新已转数
+                sourcePid.setPd_yqty(pdOutqty);
+                prodIODetailMapper.updateByPrimaryKeySelective(sourcePid);
+            }
+        }
+        return Result.success();
+
+    }
+
+    @Override
+    @Transactional
+    public void close(Long id) {
+        if(id == null || id <= 0) {
+            throw new BizException(BizExceptionCode.ILLEGAL_ID);
+        }
+        ProdInOut prodInOut =  prodInOutMapper.selectByPrimaryKey(id);
+        if(prodInOut==null){
+            throw new BizException(BizExceptionCode.NO_DATA);
+        }
+        if(Status.CLOSE.name().equals(prodInOut.getPi_status())){
+            throw new BizException(BizExceptionCode.BIZ_CLOSE);
+        }
+        prodInOut.setPi_status(Status.CLOSE.getDisplay());
+        prodInOut.setPi_statuscode(Status.CLOSE.name());
+
+        prodInOutMapper.updateByPrimaryKeySelective(prodInOut);
+        DocBaseDTO docBaseDTO = getBaseDTOById(id,prodInOut.getPi_class());
+        //日志
+        messageLogService.close(docBaseDTO);
+    }
+
+    @Override
+    @Transactional
+    public void open(Long id){
+        ProdInOut prodInOut = prodInOutMapper.selectByPrimaryKey(id);
+        if(prodInOut==null){
+            throw new BizException(BizExceptionCode.NO_DATA);
+        }
+        List<ProdIODetail> prodIODetailList = prodIODetailMapper.selectByFK(id);
+        //部分入库、全部入库
+        int partTurnCount = 0,turnCount = 0;
+        Double yqty=0.0,qty=0.0;
+        Boolean isIn = false;
+        if(BillCodeSeq.SALEIN.getName().equals(prodInOut.getPi_class())){
+            isIn=true;
+        }
+        if(prodIODetailList!=null&&prodIODetailList.size()>0){
+            for (ProdIODetail prodiodetail :prodIODetailList){
+                yqty = prodiodetail.getPd_yqty() ==null?0.0:prodiodetail.getPd_yqty();
+                if(isIn){
+                    qty = prodiodetail.getPd_inqty() ==null?0.0:prodiodetail.getPd_yqty();
+                }else{
+                    qty = prodiodetail.getPd_outqty() ==null?0.0:prodiodetail.getPd_outqty();
+                }
+                if(yqty >= qty){
+                    turnCount++;
+                }else if(yqty>0&&yqty<qty){
+                    partTurnCount++;
+                }
+            }
+        }
+        if(partTurnCount>0){
+            if(isIn){
+                prodInOut.setPi_status(Status.PART2IN.getDisplay());
+                prodInOut.setPi_statuscode(Status.PART2IN.name());
+            }else {
+                prodInOut.setPi_status(Status.PARTOUT.getDisplay());
+                prodInOut.setPi_statuscode(Status.PARTOUT.name());
+            }
+        }else if(turnCount == prodIODetailList.size()){
+            if(isIn){
+                prodInOut.setPi_status(Status.TURNIN.getDisplay());
+                prodInOut.setPi_statuscode(Status.TURNIN.name());
+            }else {
+                prodInOut.setPi_status(Status.TURNOUT.getDisplay());
+                prodInOut.setPi_statuscode(Status.TURNOUT.name());
+            }
+        }else{
+            prodInOut.setPi_status(Status.AUDITED.getDisplay());
+            prodInOut.setPi_statuscode(Status.AUDITED.getDisplay());
+        }
+        prodInOutMapper.updateByPrimaryKeySelective(prodInOut);
+        DocBaseDTO docBaseDTO = getBaseDTOById(id,prodInOut.getPi_class());
+        //记录日志
+        messageLogService.open(docBaseDTO);
+    }
+    /**
+     * @Description: 检验获取并更新单号
+     * @Param: [code, id]
+     * @return: java.lang.String
+     * @Author: guq
+     * @Date: 2018/10/19
+     */
+    private String pushMaxnubmer(String code, Long id,String pi_class) {
+        if (null == code) {
+            throw new BizException(BizExceptionCode.NULL_CODE);
+        }
+        Integer count = "0".equals(String.valueOf(id)) ? prodInOutMapper.validateCodeWhenInsert(code,pi_class) :
+                prodInOutMapper.validateCodeWhenUpdate(code, id);
+        String caller ="";
+        if(pi_class.equals("销售出货单")){
+            caller = BillCodeSeq.SALEOUT.getCaller();
+        }else {//销售退货单
+            caller = BillCodeSeq.SALEIN.getCaller();
+        }
+        return maxnumberService.pushMaxnubmer(count, code, caller).getData();
+    }
+    /**
+     * @Description: 更新已转数
+     * @Param: [code, id]
+     * @return: java.lang.String
+     * @Author: wuyx
+     * @Date: 2018/10/23
+     */
+    private void updateYqty(ProdInOut prodInOut) {
+        //更新已转数
+        if ("销售出货单".equals(prodInOut.getPi_class())){
+            prodIODetailMapper.updateSaleYqty(prodInOut.getPi_said());
+        }else if ("销售退货单".equals(prodInOut.getPi_class())){
+            prodIODetailMapper.updateSaleOutYqty(prodInOut.getPi_said());
+        }
+    }
+
+    /**
+     * @Description
+     * @Param: [id]
+     * @return: com.usoftchina.saas.commons.dto.DocBaseDTO
+     * @Author: wuyx
+     * @Date: 2018/10/25
+     */
+    private DocBaseDTO getBaseDTOById(Long id,String pi_class) {
+        if (null == id) {
+            return null;
+        }
+        String caller = BillCodeSeq.SALEIN.getName().equals(pi_class)?BillCodeSeq.SALEIN.getCaller():BillCodeSeq.SALEOUT.getCaller();
+        String code = prodInOutMapper.selectCodeById(id);
+        DocBaseDTO baseDTO = new DocBaseDTO();
+        baseDTO.setId(id);
+        baseDTO.setCode(code);
+        baseDTO.setName(caller);
+        return baseDTO;
+    }
+    //更新最新明细总额
+    private void getTotal(Long id,String pi_class) {
+        if(BillCodeSeq.SALEOUT.getName().equals(pi_class)){
+            prodIODetailMapper.updatePDSaleOut(id);
+        }else{
+            prodIODetailMapper.updatePDSaleIN(id);
+        }
+    }
+}

+ 23 - 21
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/SaleServiceImpl.java

@@ -2,10 +2,13 @@ package com.usoftchina.saas.sale.service.impl;
 
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.commons.api.MaxnumberService;
+import com.usoftchina.saas.commons.api.MessageLogService;
 import com.usoftchina.saas.commons.dto.BatchDealBaseDTO;
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.commons.dto.ListReqDTO;
 import com.usoftchina.saas.commons.exception.BizExceptionCode;
+import com.usoftchina.saas.commons.po.BillCodeSeq;
 import com.usoftchina.saas.commons.po.Status;
 import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.exception.BizException;
@@ -43,10 +46,10 @@ public class SaleServiceImpl implements SaleService{
     private SaleMapper saleMapper;
     @Autowired
     private SaledetailMapper saledetailMapper;
-   /* @Autowired
+    @Autowired
     private MessageLogService messageLogService;
     @Autowired
-    private MaxnumberService maxnumberService;*/
+    private MaxnumberService maxnumberService;
     @Autowired
     private ProdInOutMapper prodInOutMapper;
     @Autowired
@@ -113,7 +116,7 @@ public class SaleServiceImpl implements SaleService{
         sale.setCreateTime(new Date());
 
         //编号校验
-        //sa_code = pushMaxnubmer(sa_code, sa_id);
+        sa_code = pushMaxnubmer(sa_code, sa_id);
         //单号赋值
         sale.setSa_code(sa_code);
         //判断更新与保存动作
@@ -136,7 +139,7 @@ public class SaleServiceImpl implements SaleService{
             //更新销售金额
             getTotal(sa_id);
             //日志记录
-            //messageLogService.save(baseDTO);
+            messageLogService.save(baseDTO);
             return baseDTO;
         }
         //更新操作
@@ -164,7 +167,7 @@ public class SaleServiceImpl implements SaleService{
         //更新销售金额
         getTotal(sa_id);
         //日志
-        //messageLogService.save(baseDTO);
+        messageLogService.update(baseDTO);
         return baseDTO;
     }
 
@@ -179,7 +182,7 @@ public class SaleServiceImpl implements SaleService{
         Integer num = saledetailMapper.deleteByPrimaryKey(id);
         DocBaseDTO docBaseDTO = getBaseDTOById(id);
         //日志
-        //messageLogService.deleteDetail(docBaseDTO);
+        messageLogService.deleteDetail(docBaseDTO);
         return num;
     }
 
@@ -206,7 +209,7 @@ public class SaleServiceImpl implements SaleService{
         }
         String code = saleMapper.validateUnAudit(id);
         if (null != code) {
-            throw new BizException(500, "单据:" + code + " 未审核,无法反审核");
+            throw new BizException(BizExceptionCode.SALE_NULL_BILL);
         }
         singleUnAudit(id);
     }
@@ -252,7 +255,7 @@ public class SaleServiceImpl implements SaleService{
 
         DocBaseDTO docBaseDTO = getBaseDTOById(id);
         //日志
-        //messageLogService.audit(docBaseDTO);
+        messageLogService.audit(docBaseDTO);
     }
 
     private void singleDelete(Long id) {
@@ -263,7 +266,7 @@ public class SaleServiceImpl implements SaleService{
             saleMapper.deleteByPrimaryKey(id);
             DocBaseDTO docBaseDTO = getBaseDTOById(id);
             //日志
-            //messageLogService.delete(docBaseDTO);
+            messageLogService.delete(docBaseDTO);
         }
     }
 
@@ -290,14 +293,15 @@ public class SaleServiceImpl implements SaleService{
      * @Author: guq
      * @Date: 2018/10/19
      */
-   /* private String pushMaxnubmer(String code, Long id) {
+    private String pushMaxnubmer(String code, Long id) {
         if (null == code) {
             throw new BizException(BizExceptionCode.NULL_CODE);
         }
-        Integer count = "0".equals(String.valueOf(id)) ? saleMapper.validateCodeWhenInsert(code) :
-                saleMapper.validateCodeWhenUpdate(code, id);
-        return maxnumberService.pushMaxnubmer(count, code, "Purchase").getData();
-    }*/
+        Long companyId = BaseContextHolder.getCompanyId();
+        Integer count = "0".equals(String.valueOf(id)) ? saleMapper.validateCodeWhenInsert(code, companyId) :
+                saleMapper.validateCodeWhenUpdate(code, id, companyId);
+        return maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.SALE.getCaller()).getData();
+    }
 
     /**
      * @Description
@@ -343,7 +347,7 @@ public class SaleServiceImpl implements SaleService{
         saleMapper.updateByPrimaryKeySelective(sale);
         DocBaseDTO docBaseDTO = getBaseDTOById(id);
         //日志
-        //messageLogService.close(docBaseDTO);
+        messageLogService.close(docBaseDTO);
     }
 
     @Override
@@ -379,7 +383,7 @@ public class SaleServiceImpl implements SaleService{
             saleMapper.updateByPrimaryKeySelective(sale);
             DocBaseDTO docBaseDTO = getBaseDTOById(id);
             //日志
-            //messageLogService.open(docBaseDTO);
+            messageLogService.open(docBaseDTO);
         }
     }
 
@@ -419,10 +423,8 @@ public class SaleServiceImpl implements SaleService{
         //插入验收单主表
         ProdInOut prodInOut = new ProdInOut();
         //生成单号
-        //String pi_inoutno = maxnumberService.getMaxnumber("Sale", true).getData();
-       // Object data =
-        String pi_inoutno = "xxxxx" + (int)(Math.random()*100)+1;;
-
+        String pi_inoutno = maxnumberService.getMaxnumber(BillCodeSeq.SALEOUT.getCaller(),
+                true).getData();
         prodInOut.setPi_inoutno(pi_inoutno);
         prodInOut.setPi_class("出货单");
         prodInOut.setPi_date(new Date());
@@ -483,7 +485,7 @@ public class SaleServiceImpl implements SaleService{
         saleMapper.updateByPrimaryKeySelective(sale);
         DocBaseDTO docBaseDTO = getBaseDTOById(id);
         //日志
-        //messageLogService.unAudit(docBaseDTO);
+        messageLogService.unAudit(docBaseDTO);
     }
 
     //更新最新销售总额

+ 297 - 25
applications/sale/sale-server/src/main/resources/mapper/ProdIODetailMapper.xml

@@ -143,6 +143,33 @@
   <sql id="Blob_Column_List">
     pd_remark
   </sql>
+  <select id="selectByExampleWithBLOBs" parameterType="com.usoftchina.saas.storage.po.ProdIODetailExample" resultMap="ResultMapWithBLOBs">
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    ,
+    <include refid="Blob_Column_List" />
+    from prodiodetail
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null">
+      order by ${orderByClause}
+    </if>
+  </select>
+  <select id="selectByExample" parameterType="com.usoftchina.saas.storage.po.ProdIODetailExample" resultMap="BaseResultMap">
+    select
+        *
+    from prodiodetail a left join product b on a.pd_prodid = b.pr_id and a.companyid = b.companyid
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null">
+      order by ${orderByClause}
+    </if>
+  </select>
   <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
     select 
     <include refid="Base_Column_List" />
@@ -151,11 +178,19 @@
     from prodiodetail
     where pd_id = #{pd_id,jdbcType=INTEGER}
   </select>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
+    delete from prodiodetail where pd_id = #{pd_id}
+  </delete>
+  <delete id="deleteByForeignKey" parameterType="java.lang.Long">
+    delete from prodiodetail where pd_piid = #{pd_id}
+  </delete>
+  <delete id="deleteByExample" parameterType="com.usoftchina.saas.storage.po.ProdIODetailExample">
     delete from prodiodetail
-    where pd_id = #{pd_id,jdbcType=INTEGER}
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
   </delete>
-  <insert id="insert" parameterType="com.usoftchina.saas.storage.po.ProdInOut">
+  <insert id="insert" parameterType="com.usoftchina.saas.storage.po.ProdIODetail">
     insert into prodiodetail (pd_id, pd_piid, pd_inoutno, 
       pd_piclass, pd_pdno, pd_ordercode, 
       pd_orderdetno, pd_prodid, pd_prodcode, 
@@ -186,7 +221,7 @@
       #{pd_ioid,jdbcType=INTEGER}
       )
   </insert>
-  <insert id="insertSelective" parameterType="com.usoftchina.saas.storage.po.ProdInOut">
+  <insert id="insertSelective" parameterType="com.usoftchina.saas.storage.po.ProdIODetail">
     <selectKey resultType="java.lang.Long" keyProperty="id">
       SELECT LAST_INSERT_ID() AS ID
     </selectKey>
@@ -430,7 +465,233 @@
       </if>
     </trim>
   </insert>
-  <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.storage.po.ProdInOut">
+  <select id="countByExample" parameterType="com.usoftchina.saas.storage.po.ProdIODetailExample" resultType="java.lang.Long">
+    select count(*) from prodiodetail
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </select>
+  <update id="updateByExampleSelective" parameterType="map">
+    update prodiodetail
+    <set>
+      <if test="record.pd_id != null">
+        pd_id = #{record.pd_id,jdbcType=INTEGER},
+      </if>
+      <if test="record.pd_piid != null">
+        pd_piid = #{record.pd_piid,jdbcType=INTEGER},
+      </if>
+      <if test="record.pd_inoutno != null">
+        pd_inoutno = #{record.pd_inoutno,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pd_piclass != null">
+        pd_piclass = #{record.pd_piclass,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pd_pdno != null">
+        pd_pdno = #{record.pd_pdno,jdbcType=INTEGER},
+      </if>
+      <if test="record.pd_ordercode != null">
+        pd_ordercode = #{record.pd_ordercode,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pd_orderdetno != null">
+        pd_orderdetno = #{record.pd_orderdetno,jdbcType=INTEGER},
+      </if>
+      <if test="record.pd_prodid != null">
+        pd_prodid = #{record.pd_prodid,jdbcType=INTEGER},
+      </if>
+      <if test="record.pd_prodcode != null">
+        pd_prodcode = #{record.pd_prodcode,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pd_unit != null">
+        pd_unit = #{record.pd_unit,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pd_inqty != null">
+        pd_inqty = #{record.pd_inqty,jdbcType=INTEGER},
+      </if>
+      <if test="record.pd_outqty != null">
+        pd_outqty = #{record.pd_outqty,jdbcType=INTEGER},
+      </if>
+      <if test="record.pd_orderprice != null">
+        pd_orderprice = #{record.pd_orderprice,jdbcType=DOUBLE},
+      </if>
+      <if test="record.pd_sendprice != null">
+        pd_sendprice = #{record.pd_sendprice,jdbcType=DOUBLE},
+      </if>
+      <if test="record.pd_price != null">
+        pd_price = #{record.pd_price,jdbcType=DOUBLE},
+      </if>
+      <if test="record.pd_total != null">
+        pd_total = #{record.pd_total,jdbcType=DOUBLE},
+      </if>
+      <if test="record.pd_taxrate != null">
+        pd_taxrate = #{record.pd_taxrate,jdbcType=DOUBLE},
+      </if>
+      <if test="record.pd_netprice != null">
+        pd_netprice = #{record.pd_netprice,jdbcType=DOUBLE},
+      </if>
+      <if test="record.pd_nettotal != null">
+        pd_nettotal = #{record.pd_nettotal,jdbcType=DOUBLE},
+      </if>
+      <if test="record.pd_whid != null">
+        pd_whid = #{record.pd_whid,jdbcType=INTEGER},
+      </if>
+      <if test="record.pd_whcode != null">
+        pd_whcode = #{record.pd_whcode,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pd_whname != null">
+        pd_whname = #{record.pd_whname,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pd_inwhid != null">
+        pd_inwhid = #{record.pd_inwhid,jdbcType=INTEGER},
+      </if>
+      <if test="record.pd_inwhcode != null">
+        pd_inwhcode = #{record.pd_inwhcode,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pd_inwhname != null">
+        pd_inwhname = #{record.pd_inwhname,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pd_orderid != null">
+        pd_orderid = #{record.pd_orderid,jdbcType=INTEGER},
+      </if>
+      <if test="record.pd_sdid != null">
+        pd_sdid = #{record.pd_sdid,jdbcType=INTEGER},
+      </if>
+      <if test="record.pd_status != null">
+        pd_status = #{record.pd_status,jdbcType=INTEGER},
+      </if>
+      <if test="record.companyid != null">
+        companyid = #{record.companyid,jdbcType=INTEGER},
+      </if>
+      <if test="record.updaterid != null">
+        updaterid = #{record.updaterid,jdbcType=INTEGER},
+      </if>
+      <if test="record.updatetime != null">
+        updatetime = #{record.updatetime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="record.pd_text1 != null">
+        pd_text1 = #{record.pd_text1,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pd_text2 != null">
+        pd_text2 = #{record.pd_text2,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pd_text3 != null">
+        pd_text3 = #{record.pd_text3,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pd_text4 != null">
+        pd_text4 = #{record.pd_text4,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pd_text5 != null">
+        pd_text5 = #{record.pd_text5,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pd_ym != null">
+        pd_ym = #{record.pd_ym,jdbcType=INTEGER},
+      </if>
+      <if test="record.pd_yqty != null">
+        pd_yqty = #{record.pd_yqty,jdbcType=INTEGER},
+      </if>
+      <if test="record.pd_remark != null">
+        pd_remark = #{record.pd_remark,jdbcType=LONGVARCHAR},
+      </if>
+      <if test="record.pd_ioid != null">
+        pd_ioid = #{record.pd_ioid,jdbcType=INTEGER},
+      </if>
+
+    </set>
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByExampleWithBLOBs" parameterType="map">
+    update prodiodetail
+    set pd_id = #{record.pd_id,jdbcType=INTEGER},
+      pd_piid = #{record.pd_piid,jdbcType=INTEGER},
+      pd_inoutno = #{record.pd_inoutno,jdbcType=VARCHAR},
+      pd_piclass = #{record.pd_piclass,jdbcType=VARCHAR},
+      pd_pdno = #{record.pd_pdno,jdbcType=INTEGER},
+      pd_ordercode = #{record.pd_ordercode,jdbcType=VARCHAR},
+      pd_orderdetno = #{record.pd_orderdetno,jdbcType=INTEGER},
+      pd_prodid = #{record.pd_prodid,jdbcType=INTEGER},
+      pd_prodcode = #{record.pd_prodcode,jdbcType=VARCHAR},
+      pd_unit = #{record.pd_unit,jdbcType=VARCHAR},
+      pd_inqty = #{record.pd_inqty,jdbcType=INTEGER},
+      pd_outqty = #{record.pd_outqty,jdbcType=INTEGER},
+      pd_orderprice = #{record.pd_orderprice,jdbcType=DOUBLE},
+      pd_sendprice = #{record.pd_sendprice,jdbcType=DOUBLE},
+      pd_price = #{record.pd_price,jdbcType=DOUBLE},
+      pd_total = #{record.pd_total,jdbcType=DOUBLE},
+      pd_taxrate = #{record.pd_taxrate,jdbcType=DOUBLE},
+      pd_netprice = #{record.pd_netprice,jdbcType=DOUBLE},
+      pd_nettotal = #{record.pd_nettotal,jdbcType=DOUBLE},
+      pd_whid = #{record.pd_whid,jdbcType=INTEGER},
+      pd_whcode = #{record.pd_whcode,jdbcType=VARCHAR},
+      pd_whname = #{record.pd_whname,jdbcType=VARCHAR},
+      pd_inwhid = #{record.pd_inwhid,jdbcType=INTEGER},
+      pd_inwhcode = #{record.pd_inwhcode,jdbcType=VARCHAR},
+      pd_inwhname = #{record.pd_inwhname,jdbcType=VARCHAR},
+      pd_orderid = #{record.pd_orderid,jdbcType=INTEGER},
+      pd_sdid = #{record.pd_sdid,jdbcType=INTEGER},
+      pd_status = #{record.pd_status,jdbcType=INTEGER},
+      companyid = #{record.companyid,jdbcType=INTEGER},
+      updaterid = #{record.updaterid,jdbcType=INTEGER},
+      updatetime = #{record.updatetime,jdbcType=TIMESTAMP},
+      pd_text1 = #{record.pd_text1,jdbcType=VARCHAR},
+      pd_text2 = #{record.pd_text2,jdbcType=VARCHAR},
+      pd_text3 = #{record.pd_text3,jdbcType=VARCHAR},
+      pd_text4 = #{record.pd_text4,jdbcType=VARCHAR},
+      pd_text5 = #{record.pd_text5,jdbcType=VARCHAR},
+      pd_ym = #{record.pd_ym,jdbcType=INTEGER},
+      pd_yqty = #{record.pd_yqty,jdbcType=INTEGER},
+      pd_remark = #{record.pd_remark,jdbcType=LONGVARCHAR},
+      pd_ioid = #{record.pd_ioid,jdbcType=INTEGER}
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByExample" parameterType="map">
+    update prodiodetail
+    set pd_id = #{record.pd_id,jdbcType=INTEGER},
+      pd_piid = #{record.pd_piid,jdbcType=INTEGER},
+      pd_inoutno = #{record.pd_inoutno,jdbcType=VARCHAR},
+      pd_piclass = #{record.pd_piclass,jdbcType=VARCHAR},
+      pd_pdno = #{record.pd_pdno,jdbcType=INTEGER},
+      pd_ordercode = #{record.pd_ordercode,jdbcType=VARCHAR},
+      pd_orderdetno = #{record.pd_orderdetno,jdbcType=INTEGER},
+      pd_prodid = #{record.pd_prodid,jdbcType=INTEGER},
+      pd_prodcode = #{record.pd_prodcode,jdbcType=VARCHAR},
+      pd_unit = #{record.pd_unit,jdbcType=VARCHAR},
+      pd_inqty = #{record.pd_inqty,jdbcType=INTEGER},
+      pd_outqty = #{record.pd_outqty,jdbcType=INTEGER},
+      pd_orderprice = #{record.pd_orderprice,jdbcType=DOUBLE},
+      pd_sendprice = #{record.pd_sendprice,jdbcType=DOUBLE},
+      pd_price = #{record.pd_price,jdbcType=DOUBLE},
+      pd_total = #{record.pd_total,jdbcType=DOUBLE},
+      pd_taxrate = #{record.pd_taxrate,jdbcType=DOUBLE},
+      pd_netprice = #{record.pd_netprice,jdbcType=DOUBLE},
+      pd_nettotal = #{record.pd_nettotal,jdbcType=DOUBLE},
+      pd_whid = #{record.pd_whid,jdbcType=INTEGER},
+      pd_whcode = #{record.pd_whcode,jdbcType=VARCHAR},
+      pd_whname = #{record.pd_whname,jdbcType=VARCHAR},
+      pd_inwhid = #{record.pd_inwhid,jdbcType=INTEGER},
+      pd_inwhcode = #{record.pd_inwhcode,jdbcType=VARCHAR},
+      pd_inwhname = #{record.pd_inwhname,jdbcType=VARCHAR},
+      pd_orderid = #{record.pd_orderid,jdbcType=INTEGER},
+      pd_sdid = #{record.pd_sdid,jdbcType=INTEGER},
+      pd_status = #{record.pd_status,jdbcType=INTEGER},
+      companyid = #{record.companyid,jdbcType=INTEGER},
+      updaterid = #{record.updaterid,jdbcType=INTEGER},
+      updatetime = #{record.updatetime,jdbcType=TIMESTAMP},
+      pd_text1 = #{record.pd_text1,jdbcType=VARCHAR},
+      pd_text2 = #{record.pd_text2,jdbcType=VARCHAR},
+      pd_text3 = #{record.pd_text3,jdbcType=VARCHAR},
+      pd_text4 = #{record.pd_text4,jdbcType=VARCHAR},
+      pd_text5 = #{record.pd_text5,jdbcType=VARCHAR},
+      pd_ym = #{record.pd_ym,jdbcType=INTEGER},
+      pd_yqty = #{record.pd_yqty,jdbcType=INTEGER},
+      pd_ioid = #{record.pd_ioid,jdbcType=INTEGER}
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.storage.po.ProdIODetail">
     update prodiodetail
     <set>
       <if test="pd_piid != null">
@@ -553,7 +814,7 @@
     </set>
     where pd_id = #{id,jdbcType=INTEGER}
   </update>
-  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.usoftchina.saas.storage.po.ProdInOut">
+  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.usoftchina.saas.storage.po.ProdIODetail">
     update prodiodetail
     set pd_piid = #{pd_piid,jdbcType=INTEGER},
       pd_inoutno = #{pd_inoutno,jdbcType=VARCHAR},
@@ -596,7 +857,7 @@
       pd_ioid = #{pd_ioid,jdbcType=INTEGER}
     where pd_id = #{pd_id,jdbcType=INTEGER}
   </update>
-  <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.storage.po.ProdInOut">
+  <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.storage.po.ProdIODetail">
     update prodiodetail
     set pd_piid = #{pd_piid,jdbcType=INTEGER},
       pd_inoutno = #{pd_inoutno,jdbcType=VARCHAR},
@@ -911,15 +1172,7 @@
     </foreach>
   </insert>
 
-
-
-
-
-
-
-
-
-  <update id="batchUpdate" parameterType="com.usoftchina.saas.storage.po.ProdInOut" >
+  <update id="batchUpdate" parameterType="com.usoftchina.saas.storage.po.ProdIODetail" >
     <foreach collection="list" item="item" index="index" open="" close="" separator=";">
       update prodiodetail <set>
       <if test="item.pd_piid !=null">
@@ -1031,20 +1284,39 @@
     </foreach>
   </update>
 
-  <update id="updatePurchaseYqty" parameterType="java.lang.Integer">
-
-update prodiodetail a
-set a.pd_yqty =ifnull((select  b.pd_outqty  from  (select pd_ioid,sum(pd_outqty) pd_outqty from  prodiodetail left join prodinout on pd_piid = pi_id where pd_piclass='采购验退单'
-and pi_puid=#{id,jdbcType=INTEGER}  GROUP BY pd_ioid) b where ifnull(b.pd_ioid ,0)= a.pd_id ),0)
-where a.pd_piid = (select pi_id from prodinout where pi_puid=#{id,jdbcType=INTEGER} and pi_class='采购验收单')
+  <update id="updateSaleOutYqty" parameterType="long">
+update prodiodetail
+  set a.pd_yqty =ifnull((select  b.pd_inqty  from  (select pi_said,sum(pd_inqty) pd_inqty from  prodiodetail left join prodinout on pd_piid = pi_id where pd_piclass='销售退货单'
+and pi_said=#{id}  GROUP BY pd_ioid) b where ifnull(b.pd_ioid ,0)= a.pd_id ),0)
+where a.pd_piid = (select pi_id from prodinout where pi_said=#{id} and pi_class='销售出货单')
+  </update>
+  <update id="updateSaleYqty" parameterType="long">
+    update saledtail
+    set a.sd_yqty =ifnull((
+    select  b.pd_ounqty  from  (select pi_said,sum(pd_outqty) pd_outqty
+      from  prodiodetail left join prodinout on pd_piid = pi_id where pd_piclass='销售出货单'
+      and pi_said=#{id}  GROUP BY pi_said) b where ifnull(b.pd_ioid ,0)= a.pd_id
+      ),0)
+    where a.sd_said = #{id}
   </update>
-
 
   <select id="selectByFK" parameterType="long" resultMap="BaseResultMap">
     select * from prodiodetail a left join product b on b.pr_id= a.pd_prodid and a.companyid = b.companyid
     where pd_piid=#{id} order by pd_pdno
   </select>
 
-
-
+  <update id="updatePDSaleIN" parameterType="long">
+   update prodiodetail set
+   pd_total=ifnull(pd_inqty,0)*ifnull(pd_orderprice,0),
+   pd_netprice = ifnull(pd_sendprice,0)/(1+ifnull(pd_taxrate,0)/100),
+   pd_nettotal = (ifnull(pd_sendprice,0)/(1+ifnull(pd_taxrate,0)/100))*ifnull(pd_inqty)
+   where pd_piid=#{id}
+  </update>
+  <update id="updatePDSaleOut" parameterType="long">
+    update prodiodetail set
+    pd_total=ifnull(pd_outqty,0)*ifnull(pd_orderprice,0),
+    pd_netprice = ifnull(pd_sendprice,0)/(1+ifnull(pd_taxrate,0)/100),
+    pd_nettotal = (ifnull(pd_sendprice,0)/(1+ifnull(pd_taxrate,0)/100))*ifnull(pd_outqty)
+    where pd_piid=#{id}
+  </update>
 </mapper>

+ 100 - 0
applications/sale/sale-server/src/main/resources/mapper/ProdInOutListMapper.xml

@@ -0,0 +1,100 @@
+<?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.sale.mapper.ProdInOutListMapper">
+  <resultMap id="BaseResultMap" type="com.usoftchina.saas.storage.po.ProdInOutList">
+    <id column="pi_id" jdbcType="INTEGER" property="id" />
+    <result column="pi_inoutno" jdbcType="VARCHAR" property="pi_inoutno" />
+    <result column="pi_class" jdbcType="VARCHAR" property="pi_class" />
+    <result column="pi_date" jdbcType="TIMESTAMP" property="pi_date" />
+    <result column="pi_vendid" jdbcType="INTEGER" property="pi_vendid" />
+    <result column="pi_vendcode" jdbcType="VARCHAR" property="pi_vendcode" />
+    <result column="pi_vendname" jdbcType="VARCHAR" property="pi_vendname" />
+    <result column="pi_custid" jdbcType="INTEGER" property="pi_custid" />
+    <result column="pi_custcode" jdbcType="VARCHAR" property="pi_custcode" />
+    <result column="pi_custname" jdbcType="VARCHAR" property="pi_custname" />
+    <result column="pi_puid" jdbcType="INTEGER" property="pi_puid" />
+    <result column="pi_pucode" jdbcType="VARCHAR" property="pi_pucode" />
+    <result column="pi_said" jdbcType="INTEGER" property="pi_said" />
+    <result column="pi_sacode" jdbcType="VARCHAR" property="pi_sacode" />
+    <result column="pi_total" jdbcType="DOUBLE" property="pi_total" />
+    <result column="pi_recordmanid" jdbcType="INTEGER" property="pi_recordmanid" />
+    <result column="pi_recordman" jdbcType="VARCHAR" property="pi_recordman" />
+    <result column="pi_recorddate" jdbcType="TIMESTAMP" property="pi_recorddate" />
+    <result column="pi_status" jdbcType="VARCHAR" property="pi_status" />
+    <result column="pi_statuscode" jdbcType="VARCHAR" property="pi_statuscode" />
+    <result column="pi_printstatus" jdbcType="VARCHAR" property="pi_printstatus" />
+    <result column="pi_printstatuscode" jdbcType="VARCHAR" property="pi_printstatuscode" />
+    <result column="pi_text1" jdbcType="VARCHAR" property="pi_text1" />
+    <result column="pi_text2" jdbcType="VARCHAR" property="pi_text2" />
+    <result column="pi_text3" jdbcType="VARCHAR" property="pi_text3" />
+    <result column="pi_text4" jdbcType="VARCHAR" property="pi_text4" />
+    <result column="pi_text5" jdbcType="VARCHAR" property="pi_text5" />
+    <result column="pi_address" jdbcType="VARCHAR" property="pi_address" />
+    <result column="pd_piid" jdbcType="INTEGER" property="pd_piid" />
+    <result column="pd_inoutno" jdbcType="VARCHAR" property="pd_inoutno" />
+    <result column="pd_piclass" jdbcType="VARCHAR" property="pd_piclass" />
+    <result column="pd_pdno" jdbcType="INTEGER" property="pd_pdno" />
+    <result column="pd_ordercode" jdbcType="VARCHAR" property="pd_ordercode" />
+    <result column="pd_orderdetno" jdbcType="INTEGER" property="pd_orderdetno" />
+    <result column="pd_prodid" jdbcType="INTEGER" property="pd_prodid" />
+    <result column="pd_prodcode" jdbcType="VARCHAR" property="pd_prodcode" />
+    <result column="pd_unit" jdbcType="VARCHAR" property="pd_unit" />
+    <result column="pd_inqty" jdbcType="INTEGER" property="pd_inqty" />
+    <result column="pd_outqty" jdbcType="INTEGER" property="pd_outqty" />
+    <result column="pd_orderprice" jdbcType="DOUBLE" property="pd_orderprice" />
+    <result column="pd_sendprice" jdbcType="DOUBLE" property="pd_sendprice" />
+    <result column="pd_price" jdbcType="DOUBLE" property="pd_price" />
+    <result column="pd_total" jdbcType="DOUBLE" property="pd_total" />
+    <result column="pd_taxrate" jdbcType="DOUBLE" property="pd_taxrate" />
+    <result column="pd_netprice" jdbcType="DOUBLE" property="pd_netprice" />
+    <result column="pd_nettotal" jdbcType="DOUBLE" property="pd_nettotal" />
+    <result column="pd_whid" jdbcType="INTEGER" property="pd_whid" />
+    <result column="pd_whcode" jdbcType="VARCHAR" property="pd_whcode" />
+    <result column="pd_whname" jdbcType="VARCHAR" property="pd_whname" />
+    <result column="pd_inwhid" jdbcType="INTEGER" property="pd_inwhid" />
+    <result column="pd_inwhcode" jdbcType="VARCHAR" property="pd_inwhcode" />
+    <result column="pd_inwhname" jdbcType="VARCHAR" property="pd_inwhname" />
+    <result column="pd_orderid" jdbcType="INTEGER" property="pd_orderid" />
+    <result column="pd_sdid" jdbcType="INTEGER" property="pd_sdid" />
+    <result column="pd_status" jdbcType="INTEGER" property="pd_status" />
+    <result column="companyid" jdbcType="INTEGER" property="companyId" />
+    <result column="updaterid" jdbcType="INTEGER" property="updaterId" />
+    <result column="updatetime" jdbcType="TIMESTAMP" property="updateTime" />
+    <result column="pd_text1" jdbcType="VARCHAR" property="pd_text1" />
+    <result column="pd_text2" jdbcType="VARCHAR" property="pd_text2" />
+    <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_ym" jdbcType="INTEGER" property="pd_ym" />
+    <result column="pd_yqty" jdbcType="INTEGER" property="pd_yqty" />
+    <result column="pd_ioid" jdbcType="INTEGER" property="pd_ioid" />
+
+  </resultMap>
+
+
+  <select id="selectProdInOutListByCondition" resultMap="BaseResultMap">
+    select  *  from prodinout left join prodiodetail on pi_id = pd_piid
+    <where>
+      <if test="con != null">
+        ${con}
+      </if>
+      <if test="companyId != null">
+        and   prodinout.companyId = #{companyId}
+      </if> order by pi_date desc,pi_id desc,pd_pdno
+    </where>
+  </select>
+
+  <select id="selectProdInOutBycondition"  resultMap="BaseResultMap">
+    select  *  from prodinout
+      <where>
+        <if test="con != null">
+          ${con}
+        </if>
+        <if test="companyId != null">
+          and  companyId = #{companyId}
+        </if>
+      </where>
+      order by pi_id
+  </select>
+
+</mapper>

+ 252 - 5
applications/sale/sale-server/src/main/resources/mapper/ProdInOutMapper.xml

@@ -32,6 +32,9 @@
     <result column="pi_text3" jdbcType="VARCHAR" property="pi_text3" />
     <result column="pi_text4" jdbcType="VARCHAR" property="pi_text4" />
     <result column="pi_text5" jdbcType="VARCHAR" property="pi_text5" />
+
+
+
   </resultMap>
   <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.usoftchina.saas.storage.po.ProdInOut">
     <result column="pi_address" jdbcType="LONGVARCHAR" property="pi_address" />
@@ -103,6 +106,36 @@
   <sql id="Blob_Column_List">
     pi_address
   </sql>
+  <select id="selectByExampleWithBLOBs" parameterType="com.usoftchina.saas.storage.po.ProdInOutExample" resultMap="ResultMapWithBLOBs">
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    ,
+    <include refid="Blob_Column_List" />
+    from prodinout
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null">
+      order by ${orderByClause}
+    </if>
+  </select>
+  <select id="selectByExample" parameterType="com.usoftchina.saas.storage.po.ProdInOutExample" resultMap="BaseResultMap">
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    from prodinout
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null">
+      order by ${orderByClause}
+    </if>
+  </select>
   <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
     select 
     <include refid="Base_Column_List" />
@@ -115,6 +148,12 @@
     delete from prodinout
     where pi_id = #{pi_id,jdbcType=INTEGER}
   </delete>
+  <delete id="deleteByExample" parameterType="com.usoftchina.saas.storage.po.ProdInOutExample">
+    delete from prodinout
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </delete>
   <insert id="insert" parameterType="com.usoftchina.saas.storage.po.ProdInOut">
     insert into prodinout (pi_id, pi_inoutno, pi_class, 
       pi_date, pi_vendid, pi_vendcode, 
@@ -131,7 +170,7 @@
       #{pi_date,jdbcType=TIMESTAMP}, #{pi_vendid,jdbcType=INTEGER}, #{pi_vendcode,jdbcType=VARCHAR}, 
       #{pi_vendname,jdbcType=VARCHAR}, #{pi_custid,jdbcType=INTEGER}, #{pi_custcode,jdbcType=VARCHAR}, 
       #{pi_custname,jdbcType=VARCHAR}, #{pi_puid,jdbcType=INTEGER}, #{pi_pucode,jdbcType=VARCHAR}, 
-      #{pi_said,jdbcType=INTEGER}, #{pi_sacode,jdbcType=VARCHAR}, #{pi_total,jdbcType=DOUBLE},
+      #{pi_said}, #{pi_sacode,jdbcType=VARCHAR}, #{pi_total,jdbcType=DOUBLE},
       #{pi_recordmanid,jdbcType=INTEGER}, #{pi_recordman,jdbcType=VARCHAR}, #{pi_recorddate,jdbcType=TIMESTAMP}, 
       #{pi_status,jdbcType=VARCHAR}, #{pi_statuscode,jdbcType=VARCHAR}, #{pi_printstatus,jdbcType=VARCHAR}, 
       #{pi_printstatuscode,jdbcType=VARCHAR}, #{companyid,jdbcType=INTEGER}, #{updaterid,jdbcType=INTEGER}, 
@@ -273,7 +312,7 @@
         #{pi_pucode,jdbcType=VARCHAR},
       </if>
       <if test="pi_said != null">
-        #{pi_said,jdbcType=INTEGER},
+        #{pi_said},
       </if>
       <if test="pi_sacode != null">
         #{pi_sacode,jdbcType=VARCHAR},
@@ -331,7 +370,188 @@
       </if>
     </trim>
   </insert>
+  <select id="countByExample" parameterType="com.usoftchina.saas.storage.po.ProdInOutExample" resultType="java.lang.Long">
+    select count(*) from prodinout
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </select>
+  <update id="updateByExampleSelective" parameterType="map">
+    update prodinout
+    <set>
+      <if test="record.pi_id != null">
+        pi_id = #{record.pi_id,jdbcType=INTEGER},
+      </if>
+      <if test="record.pi_inoutno != null">
+        pi_inoutno = #{record.pi_inoutno,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pi_class != null">
+        pi_class = #{record.pi_class,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pi_date != null">
+        pi_date = #{record.pi_date,jdbcType=TIMESTAMP},
+      </if>
+      <if test="record.pi_vendid != null">
+        pi_vendid = #{record.pi_vendid,jdbcType=INTEGER},
+      </if>
+      <if test="record.pi_vendcode != null">
+        pi_vendcode = #{record.pi_vendcode,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pi_vendname != null">
+        pi_vendname = #{record.pi_vendname,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pi_custid != null">
+        pi_custid = #{record.pi_custid,jdbcType=INTEGER},
+      </if>
+      <if test="record.pi_custcode != null">
+        pi_custcode = #{record.pi_custcode,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pi_custname != null">
+        pi_custname = #{record.pi_custname,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pi_puid != null">
+        pi_puid = #{record.pi_puid,jdbcType=INTEGER},
+      </if>
+      <if test="record.pi_pucode != null">
+        pi_pucode = #{record.pi_pucode,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pi_said != null">
+        pi_said = #{record.pi_said},
+      </if>
+      <if test="record.pi_sacode != null">
+        pi_sacode = #{record.pi_sacode,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pi_total != null">
+        pi_total = #{record.pi_total,jdbcType=DOUBLE},
+      </if>
+      <if test="record.pi_recordmanid != null">
+        pi_recordmanid = #{record.pi_recordmanid,jdbcType=INTEGER},
+      </if>
+      <if test="record.pi_recordman != null">
+        pi_recordman = #{record.pi_recordman,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pi_recorddate != null">
+        pi_recorddate = #{record.pi_recorddate,jdbcType=TIMESTAMP},
+      </if>
+      <if test="record.pi_status != null">
+        pi_status = #{record.pi_status,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pi_statuscode != null">
+        pi_statuscode = #{record.pi_statuscode,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pi_printstatus != null">
+        pi_printstatus = #{record.pi_printstatus,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pi_printstatuscode != null">
+        pi_printstatuscode = #{record.pi_printstatuscode,jdbcType=VARCHAR},
+      </if>
+      <if test="record.companyid != null">
+        companyid = #{record.companyid,jdbcType=INTEGER},
+      </if>
+      <if test="record.updaterid != null">
+        updaterid = #{record.updaterid,jdbcType=INTEGER},
+      </if>
+      <if test="record.updatetime != null">
+        updatetime = #{record.updatetime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="record.pi_text1 != null">
+        pi_text1 = #{record.pi_text1,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pi_text2 != null">
+        pi_text2 = #{record.pi_text2,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pi_text3 != null">
+        pi_text3 = #{record.pi_text3,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pi_text4 != null">
+        pi_text4 = #{record.pi_text4,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pi_text5 != null">
+        pi_text5 = #{record.pi_text5,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pi_address != null">
+        pi_address = #{record.pi_address,jdbcType=LONGVARCHAR},
+      </if>
 
+    </set>
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByExampleWithBLOBs" parameterType="map">
+    update prodinout
+    set pi_id = #{record.pi_id,jdbcType=INTEGER},
+      pi_inoutno = #{record.pi_inoutno,jdbcType=VARCHAR},
+      pi_class = #{record.pi_class,jdbcType=VARCHAR},
+      pi_date = #{record.pi_date,jdbcType=TIMESTAMP},
+      pi_vendid = #{record.pi_vendid,jdbcType=INTEGER},
+      pi_vendcode = #{record.pi_vendcode,jdbcType=VARCHAR},
+      pi_vendname = #{record.pi_vendname,jdbcType=VARCHAR},
+      pi_custid = #{record.pi_custid,jdbcType=INTEGER},
+      pi_custcode = #{record.pi_custcode,jdbcType=VARCHAR},
+      pi_custname = #{record.pi_custname,jdbcType=VARCHAR},
+      pi_puid = #{record.pi_puid,jdbcType=INTEGER},
+      pi_pucode = #{record.pi_pucode,jdbcType=VARCHAR},
+      pi_said = #{record.pi_said},
+      pi_sacode = #{record.pi_sacode,jdbcType=VARCHAR},
+      pi_total = #{record.pi_total,jdbcType=DOUBLE},
+      pi_recordmanid = #{record.pi_recordmanid,jdbcType=INTEGER},
+      pi_recordman = #{record.pi_recordman,jdbcType=VARCHAR},
+      pi_recorddate = #{record.pi_recorddate,jdbcType=TIMESTAMP},
+      pi_status = #{record.pi_status,jdbcType=VARCHAR},
+      pi_statuscode = #{record.pi_statuscode,jdbcType=VARCHAR},
+      pi_printstatus = #{record.pi_printstatus,jdbcType=VARCHAR},
+      pi_printstatuscode = #{record.pi_printstatuscode,jdbcType=VARCHAR},
+      companyid = #{record.companyid,jdbcType=INTEGER},
+      updaterid = #{record.updaterid,jdbcType=INTEGER},
+      updatetime = #{record.updatetime,jdbcType=TIMESTAMP},
+      pi_text1 = #{record.pi_text1,jdbcType=VARCHAR},
+      pi_text2 = #{record.pi_text2,jdbcType=VARCHAR},
+      pi_text3 = #{record.pi_text3,jdbcType=VARCHAR},
+      pi_text4 = #{record.pi_text4,jdbcType=VARCHAR},
+      pi_text5 = #{record.pi_text5,jdbcType=VARCHAR},
+      pi_address = #{record.pi_address,jdbcType=LONGVARCHAR}
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByExample" parameterType="map">
+    update prodinout
+    set pi_id = #{record.pi_id,jdbcType=INTEGER},
+      pi_inoutno = #{record.pi_inoutno,jdbcType=VARCHAR},
+      pi_class = #{record.pi_class,jdbcType=VARCHAR},
+      pi_date = #{record.pi_date,jdbcType=TIMESTAMP},
+      pi_vendid = #{record.pi_vendid,jdbcType=INTEGER},
+      pi_vendcode = #{record.pi_vendcode,jdbcType=VARCHAR},
+      pi_vendname = #{record.pi_vendname,jdbcType=VARCHAR},
+      pi_custid = #{record.pi_custid,jdbcType=INTEGER},
+      pi_custcode = #{record.pi_custcode,jdbcType=VARCHAR},
+      pi_custname = #{record.pi_custname,jdbcType=VARCHAR},
+      pi_puid = #{record.pi_puid,jdbcType=INTEGER},
+      pi_pucode = #{record.pi_pucode,jdbcType=VARCHAR},
+      pi_said = #{record.pi_said},
+      pi_sacode = #{record.pi_sacode,jdbcType=VARCHAR},
+      pi_total = #{record.pi_total,jdbcType=DOUBLE},
+      pi_recordmanid = #{record.pi_recordmanid,jdbcType=INTEGER},
+      pi_recordman = #{record.pi_recordman,jdbcType=VARCHAR},
+      pi_recorddate = #{record.pi_recorddate,jdbcType=TIMESTAMP},
+      pi_status = #{record.pi_status,jdbcType=VARCHAR},
+      pi_statuscode = #{record.pi_statuscode,jdbcType=VARCHAR},
+      pi_printstatus = #{record.pi_printstatus,jdbcType=VARCHAR},
+      pi_printstatuscode = #{record.pi_printstatuscode,jdbcType=VARCHAR},
+      companyid = #{record.companyid,jdbcType=INTEGER},
+      updaterid = #{record.updaterid,jdbcType=INTEGER},
+      updatetime = #{record.updatetime,jdbcType=TIMESTAMP},
+      pi_text1 = #{record.pi_text1,jdbcType=VARCHAR},
+      pi_text2 = #{record.pi_text2,jdbcType=VARCHAR},
+      pi_text3 = #{record.pi_text3,jdbcType=VARCHAR},
+      pi_text4 = #{record.pi_text4,jdbcType=VARCHAR},
+      pi_text5 = #{record.pi_text5,jdbcType=VARCHAR}
+
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
   <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.storage.po.ProdInOut">
     update prodinout
     <set>
@@ -369,7 +589,7 @@
         pi_pucode = #{pi_pucode,jdbcType=VARCHAR},
       </if>
       <if test="pi_said != null">
-        pi_said = #{pi_said,jdbcType=INTEGER},
+        pi_said = #{pi_said},
       </if>
       <if test="pi_sacode != null">
         pi_sacode = #{pi_sacode,jdbcType=VARCHAR},
@@ -442,7 +662,7 @@
       pi_custname = #{pi_custname,jdbcType=VARCHAR},
       pi_puid = #{pi_puid,jdbcType=INTEGER},
       pi_pucode = #{pi_pucode,jdbcType=VARCHAR},
-      pi_said = #{pi_said,jdbcType=INTEGER},
+      pi_said = #{pi_said},
       pi_sacode = #{pi_sacode,jdbcType=VARCHAR},
       pi_total = #{pi_total,jdbcType=DOUBLE},
       pi_recordmanid = #{pi_recordmanid,jdbcType=INTEGER},
@@ -477,7 +697,7 @@
       pi_custname = #{pi_custname,jdbcType=VARCHAR},
       pi_puid = #{pi_puid,jdbcType=INTEGER},
       pi_pucode = #{pi_pucode,jdbcType=VARCHAR},
-      pi_said = #{pi_said,jdbcType=INTEGER},
+      pi_said = #{pi_said},
       pi_sacode = #{pi_sacode,jdbcType=VARCHAR},
       pi_total = #{pi_total,jdbcType=DOUBLE},
       pi_recordmanid = #{pi_recordmanid,jdbcType=INTEGER},
@@ -497,4 +717,31 @@
       pi_text5 = #{pi_text5,jdbcType=VARCHAR}
     where pi_id = #{id,jdbcType=INTEGER}
   </update>
+  <select id="selectCodeById" resultType="string" parameterType="long">
+    select pi_inoutno from prodinout where pi_id=#{id}
+  </select>
+  <select id="validateCodeWhenInsert"  resultType="int">
+    select count(1) from prodinout where pi_inoutno = #{code} and pi_class = #{pi_class}
+  </select>
+  <select id="validateCodeWhenUpdate" resultType="int" >
+    select count(1) from prodinout where pi_inoutno = #{code} and pi_id != #{id}
+  </select>
+  <select id="validateUnAudit" parameterType="long" resultType="java.lang.String">
+    select pi_inoutno from prodinout where pi_id = #{id} and IFNULL(pi_statuscode,'UNAUDITED')!='AUDITED'
+  </select>
+  <select id="validateAudit" parameterType="com.usoftchina.saas.commons.dto.DocBaseDTO" resultType="java.lang.String">
+    select GROUP_CONCAT(pi_inoutno) from prodinout where pi_statuscode='AUDITED' and pi_id in
+    <foreach collection="list" item="item" open="(" close=")" separator=",">
+      #{item.id}
+    </foreach>
+  </select>
+
+  <select id="validateBatchUnAudit" parameterType="com.usoftchina.saas.commons.dto.DocBaseDTO" resultType="java.lang.String">
+    select GROUP_CONCAT(pi_inoutno) from prodinout where pi_statuscode='UNAUDITED' and pi_id in
+    <foreach collection="list" item="item" open="(" close=")" separator=",">
+      #{item.id}
+    </foreach>
+  </select>
+
+
 </mapper>

+ 3 - 3
applications/sale/sale-server/src/main/resources/mapper/SaleMapper.xml

@@ -336,11 +336,11 @@
     where sa_id = #{id,jdbcType=INTEGER}
   </update>
 
-  <select id="validateCodeWhenInsert" resultType="int" parameterType="string" >
-    select count(1) from sale where sa_code = #{code}
+  <select id="validateCodeWhenInsert" resultType="int">
+    select count(1) from sale where sa_code = #{code} and companyid = #{companyId}
   </select>
   <select id="validateCodeWhenUpdate" resultType="int" >
-    select count(1) from sale where sa_code = #{code} and sa_id != #{id}
+    select count(1) from sale where sa_code = #{code} and sa_id != #{id} and companyid = #{companyId}
   </select>
   <select id="selectCodeById" resultType="string" parameterType="long">
     select sa_code from sale where sa_id=#{id}

+ 1 - 1
applications/storage/storage-dto/src/main/java/com/usoftchina/saas/storage/po/ProdIODetail.java

@@ -59,7 +59,7 @@ public class ProdIODetail extends CommonBaseEntity implements Serializable {
 
     private Long pd_orderid;
 
-    private Integer pd_sdid;
+    private Long pd_sdid;
 
     private Integer pd_status;
 

+ 9 - 30
frontend/saas-web/app/view/purchase/purchase/FormPanel.js

@@ -14,8 +14,8 @@ Ext.define('saas.view.purchase.purchase.FormPanel', {
      _codeField: 'pu_code',
      _statusField: 'pu_status',
      _statusCodeField: 'pu_statuscode',
-     
      _relationColumn: 'pd_puid',
+
      _readUrl:basePath+'purchase/purchase/read/',
      _saveUrl:basePath+'purchase/purchase/save',
      _auditUrl:basePath+'purchase/purchase/audit',
@@ -33,45 +33,24 @@ Ext.define('saas.view.purchase.purchase.FormPanel', {
     defaultItems: [{
         xtype: 'hidden',
         name: 'id',
-        bind: '{id}',
         fieldLabel: 'id',
-        allowBlank: true,
         columnWidth: 0
-    }, {
-        xtype : "textfield", 
-        name : "pu_code", 
-        bind : "{pu_code}", 
-        fieldLabel : "采购单号", 
-        allowBlank : true, 
-        columnWidth : 0.25
     }, {
         xtype : "hidden", 
         name : "pu_vendid", 
-        bind : "{pu_vendid}", 
-        fieldLabel : "供应商ID", 
-        allowBlank : true, 
-        columnWidth : 0.0
+        fieldLabel : "供应商ID"
     }, {
-        xtype : "dbfindtrigger", 
+        xtype : "hidden", 
         name : "pu_vendcode", 
-        bind : "{pu_vendcode}", 
-        fieldLabel : "供应商编号", 
-        allowBlank : true, 
-        columnWidth : 0.25, 
+        fieldLabel : "供应商编号"
     }, {
-        xtype : "textfield", 
+        xtype : "dbfindtrigger", 
         name : "pu_vendname", 
-        bind : "{pu_vendname}", 
-        fieldLabel : "供应商名称", 
-        allowBlank : true, 
-        columnWidth : 0.25
+        fieldLabel : "供应商名称"
     },{
-        xtype : "datefield", 
-        name : "pu_date", 
-        bind : "{pu_date}", 
-        fieldLabel : "采购日期", 
-        allowBlank : false, 
-        columnWidth : 0.25
+        xtype : "hidden", 
+        name : "pu_delivery", 
+        fieldLabel : "交货日期"
     }, {
         xtype : "hidden", 
         name : "pu_buyerid", 

+ 3 - 3
frontend/saas-web/app/view/purchase/purchase/FormPanelController.js

@@ -9,7 +9,7 @@ Ext.define('saas.view.purchase.purchase.FormPanelController', {
                 beforerender:function(f){
                     Ext.apply(f,{
                         //数据接口
-                        dataUrl:'http://192.168.253.41:9480/vendor/getVendorsByCondition',
+                        dataUrl:basePath+'document/vendor/getVendorsByCondition',
                         //赋值 
                         dbfinds:[{
                             from:'ve_code',to:'pu_vendcode'
@@ -70,7 +70,7 @@ Ext.define('saas.view.purchase.purchase.FormPanelController', {
                 beforerender:function(f){
                     Ext.apply(f,{
                         //数据接口
-                        dataUrl:'http://192.168.253.41:9480/product/getProductsByCondition',
+                        dataUrl:basePath+'document/product/getProductsByCondition',
                         //放大镜赋值设置
                         dbfinds:[{
                             from:'pr_code',to:'pd_prodcode'
@@ -132,7 +132,7 @@ Ext.define('saas.view.purchase.purchase.FormPanelController', {
                 beforerender:function(f){
                     Ext.apply(f,{
                         //数据接口
-                        dataUrl:'http://192.168.253.41:9480/product/getProductsByCondition',
+                        dataUrl:'http://192.168.253.31:9480/product/getProductsByCondition',
                         //放大镜赋值设置
                         dbfinds:[{
                             from:'pr_code',to:'pd_prodcode'