Browse Source

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

guq 7 years ago
parent
commit
4021be8c4a
38 changed files with 393 additions and 208 deletions
  1. 9 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/Fundtransfer.java
  2. 5 8
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/RecdetailView.java
  3. 1 1
      applications/money/money-server/src/main/resources/mapper/AcountbalanceViewMapper.xml
  4. 1 1
      applications/money/money-server/src/main/resources/mapper/CustomerCheckViewMapper.xml
  5. 2 1
      applications/money/money-server/src/main/resources/mapper/FundtransferMapper.xml
  6. 1 1
      applications/money/money-server/src/main/resources/mapper/PaydetailViewMapper.xml
  7. 2 2
      applications/money/money-server/src/main/resources/mapper/RecdetailViewMapper.xml
  8. 1 1
      applications/money/money-server/src/main/resources/mapper/VendorAcountViewMapper.xml
  9. 0 1
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/ProdInOutServiceImpl.java
  10. 1 1
      applications/purchase/purchase-server/src/main/resources/application.yml
  11. 1 1
      applications/storage/storage-dto/src/main/java/com/usoftchina/saas/storage/dto/ProdIODetailDTO.java
  12. 1 1
      applications/storage/storage-dto/src/main/java/com/usoftchina/saas/storage/po/Make.java
  13. 3 121
      applications/storage/storage-dto/src/main/java/com/usoftchina/saas/storage/po/MakeMaterial.java
  14. 2 2
      applications/storage/storage-dto/src/main/java/com/usoftchina/saas/storage/po/ProdIODetail.java
  15. 2 2
      applications/storage/storage-dto/src/main/java/com/usoftchina/saas/storage/po/StockTaking.java
  16. 28 2
      applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/controller/StocktakingController.java
  17. 1 1
      applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/mapper/MakeMapper.java
  18. 7 1
      applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/mapper/StockTakingMapper.java
  19. 5 0
      applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/StocktakingService.java
  20. 156 2
      applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/impl/StocktakingServiceImpl.java
  21. 18 1
      applications/storage/storage-server/src/main/resources/mapper/StockTakingMapper.xml
  22. 2 2
      frontend/saas-web/app/view/core/form/FormPanel.js
  23. 2 0
      frontend/saas-web/app/view/core/form/field/ConDateField.js
  24. 5 5
      frontend/saas-web/app/view/home/InfoCard.js
  25. 1 1
      frontend/saas-web/app/view/home/charts/PurchaseTrend.js
  26. 1 1
      frontend/saas-web/app/view/home/charts/StockAmount.js
  27. 1 1
      frontend/saas-web/app/view/money/fundtransfer/QueryPanel.js
  28. 1 1
      frontend/saas-web/app/view/money/recBalance/QueryPanel.js
  29. 0 1
      frontend/saas-web/app/view/money/report/AccountBalance.js
  30. 1 1
      frontend/saas-web/app/view/money/report/CustomerCheck.js
  31. 9 2
      frontend/saas-web/app/view/money/report/RecDetail.js
  32. 1 1
      frontend/saas-web/app/view/money/report/VendorCheck.js
  33. 107 31
      frontend/saas-web/app/view/stock/inventory/EditDataList.js
  34. 5 0
      frontend/saas-web/app/view/stock/inventory/EditDataListModel.js
  35. 1 1
      frontend/saas-web/app/view/stock/make/FormPanel.js
  36. 7 7
      frontend/saas-web/app/view/stock/make/FormPanelController.js
  37. 1 1
      frontend/saas-web/app/view/stock/otherIn/FormPanel.js
  38. 1 1
      frontend/saas-web/app/view/stock/otherOut/FormPanel.js

+ 9 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/Fundtransfer.java

@@ -44,12 +44,21 @@ public class Fundtransfer extends CommonBaseEntity implements Serializable {
     private String ftd_paymethod;
 
     private String ftd_paycode;
+    private String ftd_remark;
 
     private String ft_auditman;
 
     private Date ft_auditdate;
 
 
+    public String getFtd_remark() {
+        return ftd_remark;
+    }
+
+    public void setFtd_remark(String ftd_remark) {
+        this.ftd_remark = ftd_remark;
+    }
+
     public String getFt_auditman() {
         return ft_auditman;
     }

+ 5 - 8
applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/RecdetailView.java

@@ -25,13 +25,17 @@ public class RecdetailView {
 
     private Double mustpay;
 
-    private Double mustdate;
+    private Date mustdate;
 
     private Double pi_total;
 
     private String pi_remark;
     private Integer companyId;
 
+    public void setMustdate(Date mustdate) {
+        this.mustdate = mustdate;
+    }
+
     public Integer getCompanyId() {
         return companyId;
     }
@@ -104,13 +108,6 @@ public class RecdetailView {
         this.mustpay = mustpay;
     }
 
-    public Double getMustdate() {
-        return mustdate;
-    }
-
-    public void setMustdate(Double mustdate) {
-        this.mustdate = mustdate;
-    }
 
     public Double getPi_total() {
         return pi_total;

+ 1 - 1
applications/money/money-server/src/main/resources/mapper/AcountbalanceViewMapper.xml

@@ -27,7 +27,7 @@
         and  companyId = #{companyId}
       </if>
     </where>
-    order by bankname, date, bankid desc
+    order by bankname asc, date desc, bankid desc
   </select>
 
 </mapper>

+ 1 - 1
applications/money/money-server/src/main/resources/mapper/CustomerCheckViewMapper.xml

@@ -30,7 +30,7 @@
                 and  companyId = #{companyId}
             </if>
         </where>
-        order by pi_date desc
+        order by pi_custname asc, pi_date desc, pi_custcode desc
     </select>
 
 </mapper>

+ 2 - 1
applications/money/money-server/src/main/resources/mapper/FundtransferMapper.xml

@@ -24,6 +24,7 @@
     <result column="ftd_nowbalance" property="ftd_nowbalance" jdbcType="DOUBLE" />
     <result column="ftd_paymethod" property="ftd_paymethod" jdbcType="VARCHAR" />
     <result column="ftd_paycode" property="ftd_paycode" jdbcType="VARCHAR" />
+    <result column="ftd_remark" property="ftd_remark" jdbcType="VARCHAR" />
     <result column="creatorName" property="creatorName" jdbcType="VARCHAR" />
     <result column="updaterName" property="updaterName" jdbcType="VARCHAR" />
     <result column="ft_auditman" property="ft_auditman" jdbcType="VARCHAR" />
@@ -37,7 +38,7 @@
     ft_auditman, ft_auditdate
   </sql>
   <sql id="Detail_Column_List" >
-    ftd_bankname,ftd_inbankname,ftd_nowbalance,ftd_paymethod,ftd_paycode
+    ftd_bankname,ftd_inbankname,ftd_nowbalance,ftd_paymethod,ftd_paycode,ftd_remark
   </sql>
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
     select 

+ 1 - 1
applications/money/money-server/src/main/resources/mapper/PaydetailViewMapper.xml

@@ -29,7 +29,7 @@
         and  companyId = #{companyId}
       </if>
     </where>
-    order by pb_date desc
+    order by pi_vendname asc, pb_date desc,pi_vendcode desc
   </select>
 
 </mapper>

+ 2 - 2
applications/money/money-server/src/main/resources/mapper/RecdetailViewMapper.xml

@@ -13,7 +13,7 @@
     <result column="rb_rdamount" property="rb_rdamount" jdbcType="DOUBLE" />
     <result column="rb_rbdamount" property="rb_rbdamount" jdbcType="DOUBLE" />
     <result column="mustpay" property="mustpay" jdbcType="DOUBLE" />
-    <result column="mustdate" property="mustdate" jdbcType="DOUBLE" />
+    <result column="mustdate" property="mustdate" jdbcType="TIMESTAMP" />
     <result column="pi_total" property="pi_total" jdbcType="DOUBLE" />
     <result column="pi_remark" property="pi_remark" jdbcType="VARCHAR" />
   <result column="companyId" property="companyId" jdbcType="INTEGER" />
@@ -29,6 +29,6 @@
         and  companyId = #{companyId}
       </if>
     </where>
-    order by rb_date desc
+    order by pi_custname asc, rb_date desc, pi_custcode desc
   </select>
 </mapper>

+ 1 - 1
applications/money/money-server/src/main/resources/mapper/VendorAcountViewMapper.xml

@@ -32,6 +32,6 @@
         and  companyId = #{companyId}
       </if>
     </where>
-    order by pi_date desc
+    order by pi_vendname asc, pi_date desc, pi_vendcode desc
   </select>
 </mapper>

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

@@ -438,7 +438,6 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         targetPi.setPi_date(new Date());
         targetPi.setPi_status("未审核");
         targetPi.setPi_statuscode("UNAUDITED");
-        targetPi.setPi_recorddate(new Date());
         targetPi.setPi_vendid(sourcePi.getPi_vendid());
         targetPi.setPi_vendcode(sourcePi.getPi_vendcode());
         targetPi.setPi_vendname(sourcePi.getPi_vendname());

+ 1 - 1
applications/purchase/purchase-server/src/main/resources/application.yml

@@ -47,7 +47,7 @@ eureka:
   client:
     registryFetchIntervalSeconds: 5
     serviceUrl:
-      defaultZone: http://${spring.security.user.name}:${spring.security.user.password}@192.168.0.181:8510/eureka/
+      defaultZone: http://${spring.security.user.name}:${spring.security.user.password}@localhost:8500/eureka/
 management:
   endpoints:
     web:

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

@@ -49,7 +49,7 @@ public class ProdIODetailDTO extends CommonBaseDTO implements Serializable {
 
     private Double pd_nettotal;
 
-    private Integer pd_whid;
+    private Long pd_whid;
 
     private String pd_whcode;
 

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

@@ -30,7 +30,7 @@ public class Make extends CommonBaseEntity implements Serializable {
 
     private Double ma_qty;
 
-    private Integer ma_whid;
+    private Long ma_whid;
 
     private String ma_whcode;
 

+ 3 - 121
applications/storage/storage-dto/src/main/java/com/usoftchina/saas/storage/po/MakeMaterial.java

@@ -2,16 +2,16 @@ package com.usoftchina.saas.storage.po;
 
 import com.usoftchina.saas.base.entity.CommonBaseEntity;
 import com.usoftchina.saas.document.dto.ProductDTO;
-import com.usoftchina.saas.document.entities.Product;
+import lombok.Data;
 
 import java.io.Serializable;
-import java.util.Date;
 
 /**
  * 制造单明细
  * @author chenwei
  * @date 2018/10/29
  */
+@Data
 public class MakeMaterial extends CommonBaseEntity implements Serializable {
     private Long mm_maid;
 
@@ -21,7 +21,7 @@ public class MakeMaterial extends CommonBaseEntity implements Serializable {
 
     private String mm_prodcode;
 
-    private Integer mm_whid;
+    private Long mm_whid;
 
     private String mm_whcode;
 
@@ -41,123 +41,5 @@ public class MakeMaterial extends CommonBaseEntity implements Serializable {
 
     private ProductDTO productDTO;
 
-    public String getMm_whname() {
-        return mm_whname;
-    }
 
-    public void setMm_whname(String mm_whname) {
-        this.mm_whname = mm_whname;
-    }
-
-    public ProductDTO getProductDTO() {
-        return productDTO;
-    }
-
-    public void setProductDTO(ProductDTO productDTO) {
-        this.productDTO = productDTO;
-    }
-
-    public Long getMm_maid() {
-        return mm_maid;
-    }
-
-    public void setMm_maid(Long mm_maid) {
-        this.mm_maid = mm_maid;
-    }
-
-    public Integer getMm_detno() {
-        return mm_detno;
-    }
-
-    public void setMm_detno(Integer mm_detno) {
-        this.mm_detno = mm_detno;
-    }
-
-    public Long getMm_prodid() {
-        return mm_prodid;
-    }
-
-    public void setMm_prodid(Long mm_prodid) {
-        this.mm_prodid = mm_prodid;
-    }
-
-    public String getMm_prodcode() {
-        return mm_prodcode;
-    }
-
-    public void setMm_prodcode(String mm_prodcode) {
-        this.mm_prodcode = mm_prodcode == null ? null : mm_prodcode.trim();
-    }
-
-    public Integer getMm_whid() {
-        return mm_whid;
-    }
-
-    public void setMm_whid(Integer mm_whid) {
-        this.mm_whid = mm_whid;
-    }
-
-    public String getMm_whcode() {
-        return mm_whcode;
-    }
-
-    public void setMm_whcode(String mm_whcode) {
-        this.mm_whcode = mm_whcode == null ? null : mm_whcode.trim();
-    }
-
-    public Double getMm_price() {
-        return mm_price;
-    }
-
-    public void setMm_price(Double mm_price) {
-        this.mm_price = mm_price;
-    }
-
-    public Double getMm_oneuseqty() {
-        return mm_oneuseqty;
-    }
-
-    public void setMm_oneuseqty(Double mm_oneuseqty) {
-        this.mm_oneuseqty = mm_oneuseqty;
-    }
-
-    public Double getMm_qty() {
-        return mm_qty;
-    }
-
-    public void setMm_qty(Double mm_qty) {
-        this.mm_qty = mm_qty;
-    }
-
-    public Double getMm_amount() {
-        return mm_amount;
-    }
-
-    public void setMm_amount(Double mm_amount) {
-        this.mm_amount = mm_amount;
-    }
-
-    public String getMm_repprodcode() {
-        return mm_repprodcode;
-    }
-
-    public void setMm_repprodcode(String mm_repprodcode) {
-        this.mm_repprodcode = mm_repprodcode == null ? null : mm_repprodcode.trim();
-    }
-
-    public String getMm_remark() {
-        return mm_remark;
-    }
-
-    public void setMm_remark(String mm_remark) {
-        this.mm_remark = mm_remark == null ? null : mm_remark.trim();
-    }
-
-    public Date getUpdateTime() {
-        return updateTime;
-    }
-
-    public void setUpdateTime(Date updateTime) {
-        this.updateTime = updateTime;
-    }
 }

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

@@ -45,13 +45,13 @@ public class ProdIODetail extends CommonBaseEntity implements Serializable {
 
     private Double pd_nettotal;
 
-    private Integer pd_whid;
+    private Long pd_whid;
 
     private String pd_whcode;
 
     private String pd_whname;
 
-    private Integer pd_inwhid;
+    private Long pd_inwhid;
 
     private String pd_inwhcode;
 

+ 2 - 2
applications/storage/storage-dto/src/main/java/com/usoftchina/saas/storage/po/StockTaking.java

@@ -7,7 +7,7 @@ import java.io.Serializable;
 @Data
 public class StockTaking extends CommonBaseEntity implements Serializable {
 
-    private Integer st_prodid;
+    private Long st_prodid;
 
     private String st_prodcode;
 
@@ -19,7 +19,7 @@ public class StockTaking extends CommonBaseEntity implements Serializable {
 
     private String st_produnit;
 
-    private Integer st_whid;
+    private Long st_whid;
 
     private String st_whcode;
 

+ 28 - 2
applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/controller/StocktakingController.java

@@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
+import java.util.Map;
 
 @RestController
 @RequestMapping("/stocktaking")
@@ -22,6 +23,17 @@ public class StocktakingController {
     @Autowired
     private StocktakingService stocktakingService;
 
+    /**
+     * 生成临时表数据
+     * @param page
+     * @param listReqDTO
+     * @return
+     */
+    @PostMapping("/build")
+    public Result buildListDataByCondition(@RequestBody ListReqDTO listReqDTO){
+        stocktakingService.buildListDataByCondition(listReqDTO);
+        return Result.success();
+    }
 
 
     /**
@@ -35,8 +47,11 @@ public class StocktakingController {
         return Result.success(stocktakingService.getList(page, listReqDTO));
     }
 
-
-
+    /**
+     * 保存
+     * @param list
+     * @return
+     */
     @PostMapping("/save")
     public Result save(@RequestBody List<StockTakingDTO> list){
         DocBaseDTO docBaseDTO = stocktakingService.saveOrUpdate(list);
@@ -44,6 +59,17 @@ public class StocktakingController {
     }
 
 
+    /**
+     * 生成盘点单据
+     * @param list
+     * @return
+     */
+    @GetMapping("/stock")
+    public Result stock(){
+        Map<String,Object> map = stocktakingService.stock();
+        return Result.success(map);
+    }
+
 
 
 }

+ 1 - 1
applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/mapper/MakeMapper.java

@@ -26,7 +26,7 @@ public interface MakeMapper extends CommonBaseMapper<Make> {
 
     int validateCodeWhenUpdate(@Param("code") String code, @Param("id") Long id, @Param("companyId") Long company);
 
-    Double getOnHand(@Param("prodid") Long prodid, @Param("whid") Integer whid, @Param("companyId") Long companyId);
+    Double getOnHand(@Param("prodid") Long prodid, @Param("whid") Long whid, @Param("companyId") Long companyId);
 
     ProdInOut selectMakeInOutCode(@Param("code") String code, @Param("companyId") Long companyId, @Param("type") String type);
 

+ 7 - 1
applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/mapper/StockTakingMapper.java

@@ -15,5 +15,11 @@ public interface StockTakingMapper extends CommonBaseMapper<StockTaking> {
 
     int updateByPrimaryKeySelective(StockTaking record);
 
-    List<StockTaking> selectStockTakingBycondition(@Param("con") String con, @Param("companyId") Long companyId);
+    List<StockTaking> selectStockTakingBycondition(@Param("con") String con,@Param("companyId") Long companyId);
+
+    void deleteByCompany(@Param("companyId") Long companyId);
+
+    void insertFormProductWh(@Param("con") String con,@Param("companyId") Long companyId);
+
+    Double getPurcpriceByProduct(Long id);
 }

+ 5 - 0
applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/StocktakingService.java

@@ -11,10 +11,15 @@ import com.usoftchina.saas.storage.mapper.StockTakingMapper;
 import com.usoftchina.saas.storage.po.StockTaking;
 
 import java.util.List;
+import java.util.Map;
 
 public interface StocktakingService extends CommonBaseService<StockTakingMapper, StockTaking> {
 
     PageInfo<StockTaking>  getList(PageRequest page, ListReqDTO listReqDTO);
 
     DocBaseDTO saveOrUpdate(List<StockTakingDTO> list);
+
+    void buildListDataByCondition(ListReqDTO listReqDTO);
+
+    Map<String,Object> stock();
 }

+ 156 - 2
applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/impl/StocktakingServiceImpl.java

@@ -3,19 +3,31 @@ package com.usoftchina.saas.storage.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.MaxnumberService;
 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.context.BaseContextHolder;
+import com.usoftchina.saas.exception.BizException;
 import com.usoftchina.saas.page.PageRequest;
 import com.usoftchina.saas.storage.dto.StockTakingDTO;
+import com.usoftchina.saas.storage.mapper.ProdIODetailMapper;
+import com.usoftchina.saas.storage.mapper.ProdInOutMapper;
 import com.usoftchina.saas.storage.mapper.StockTakingMapper;
+import com.usoftchina.saas.storage.po.ProdIODetail;
+import com.usoftchina.saas.storage.po.ProdInOut;
 import com.usoftchina.saas.storage.po.StockTaking;
 import com.usoftchina.saas.storage.service.StocktakingService;
 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 java.util.Date;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * Created by zdw
@@ -24,6 +36,15 @@ import java.util.List;
 @Service
 public class StocktakingServiceImpl extends CommonBaseServiceImpl<StockTakingMapper, StockTaking> implements StocktakingService {
 
+    @Autowired
+    private MaxnumberService maxnumberService;
+    @Autowired
+    private ProdInOutMapper prodInOutMapper;
+    @Autowired
+    private ProdIODetailMapper prodIODetailMapper;
+
+
+
     @Override
     public PageInfo<StockTaking> getList(PageRequest page, ListReqDTO listReqDTO) {
         PageHelper.startPage(page.getNumber(), page.getSize());
@@ -44,14 +65,147 @@ public class StocktakingServiceImpl extends CommonBaseServiceImpl<StockTakingMap
         return baseDTO;
     }
 
-    private List<StockTaking> getList(ListReqDTO listReqDTO) {
+    @Override
+    @Transactional
+    public void buildListDataByCondition(ListReqDTO listReqDTO) {
         List<StockTaking> list = null;
         Long companyId = BaseContextHolder.getCompanyId();
         String con = listReqDTO.getFinalCondition();
+        //删除该companyid的数据
+        getMapper().deleteByCompany(companyId);
         if (null == con) {
             con = "1=1";
         }
-        list = getMapper().selectStockTakingBycondition(con,companyId);
+        //查询存入临时表
+        getMapper().insertFormProductWh(con,companyId);
+    }
+
+    @Override
+    @Transactional
+    public Map<String,Object> stock() {
+        Map<String,Object> resultMap = new HashMap();
+
+        Long companyId = BaseContextHolder.getCompanyId();
+        Long userId = BaseContextHolder.getUserId();
+        //生成入库单
+        ProdInOut prodIn = new ProdInOut();
+        String piInno = getMaxnumber(BillCodeSeq.OTHERIN);
+        prodIn.setPi_inoutno(piInno);
+        prodIn.setPi_class(BillCodeSeq.OTHERIN.getName());
+        prodIn.setPi_date(new Date());
+        prodIn.setPi_status("未审核");
+        prodIn.setPi_statuscode("UNAUDITED");
+        prodIn.setCompanyId(companyId);
+        prodIn.setCreateTime(new Date());
+        prodIn.setCreatorId(userId);
+        prodIn.setPi_remark("盘盈单");
+        prodInOutMapper.insertSelective(prodIn);
+        long inid = prodIn.getId();
+
+        Double purcprice = null;
+
+        List<StockTaking> inlist  = getMapper().selectStockTakingBycondition("st_num>0",companyId);
+        for (int i=0;i<inlist.size();i++) {
+            StockTaking st = inlist.get(i);
+            ProdIODetail prodInDetail = new ProdIODetail();
+            prodInDetail.setPd_piid(inid);
+            prodInDetail.setPd_inoutno(piInno);
+            prodInDetail.setPd_piclass(BillCodeSeq.OTHERIN.getName());
+            prodInDetail.setPd_pdno(i+1);
+
+            purcprice = getMapper().getPurcpriceByProduct(st.getSt_prodid());
+            prodInDetail.setPd_orderprice(purcprice==null?0:purcprice);
+            prodInDetail.setPd_prodid(st.getSt_prodid());
+            prodInDetail.setPd_prodcode(st.getSt_prodcode());
+            prodInDetail.setPd_inqty(st.getSt_num());
+            //仓库
+            prodInDetail.setPd_whid(st.getSt_whid());
+            prodInDetail.setPd_whcode(st.getSt_whcode());
+            prodInDetail.setPd_whname(st.getSt_whname());
+            prodInDetail.setCompanyId(companyId);
+            prodInDetail.setCreateTime(new Date());
+            prodInDetail.setCreatorId(userId);
+            prodIODetailMapper.insertSelective(prodInDetail);
+        }
+
+        //生成出库单
+        ProdInOut prodOut = new ProdInOut();
+        String piOutno = getMaxnumber(BillCodeSeq.OTHEROUT);
+        prodOut.setPi_inoutno(piOutno);
+        prodOut.setPi_class(BillCodeSeq.OTHEROUT.getName());
+        prodOut.setPi_date(new Date());
+        prodOut.setPi_status("未审核");
+        prodOut.setPi_statuscode("UNAUDITED");
+        prodOut.setCompanyId(companyId);
+        prodOut.setCreateTime(new Date());
+        prodOut.setCreatorId(userId);
+        prodOut.setPi_remark("盘亏单");
+        prodInOutMapper.insertSelective(prodOut);
+        long outid = prodOut.getId();
+
+        List<StockTaking> outlist  = getMapper().selectStockTakingBycondition("st_num<0",companyId);
+        for (int i=0;i<outlist.size();i++) {
+            StockTaking st = outlist.get(i);
+            ProdIODetail prodOutDetail = new ProdIODetail();
+            prodOutDetail.setPd_piid(outid);
+            prodOutDetail.setPd_inoutno(piOutno);
+            prodOutDetail.setPd_piclass(BillCodeSeq.OTHERIN.getName());
+            prodOutDetail.setPd_pdno(i+1);
+            prodOutDetail.setPd_prodid(st.getSt_prodid());
+            prodOutDetail.setPd_prodcode(st.getSt_prodcode());
+            prodOutDetail.setPd_outqty(-st.getSt_num());
+            //仓库
+            prodOutDetail.setPd_whid(st.getSt_whid());
+            prodOutDetail.setPd_whcode(st.getSt_whcode());
+            prodOutDetail.setPd_whname(st.getSt_whname());
+            prodOutDetail.setCompanyId(companyId);
+            prodOutDetail.setCreateTime(new Date());
+            prodOutDetail.setCreatorId(userId);
+            prodIODetailMapper.insertSelective(prodOutDetail);
+        }
+        DocBaseDTO baseDTOIN = new DocBaseDTO(inid,piInno,"其它入库单");
+        DocBaseDTO baseDTOOUT = new DocBaseDTO(outid,piOutno,"其它出库单");
+        resultMap.put("inData",baseDTOIN);
+        resultMap.put("outData",baseDTOOUT);
+        return resultMap;
+    }
+
+    private List<StockTaking> getList(ListReqDTO listReqDTO) {
+        List<StockTaking> list = null;
+        Long companyId = BaseContextHolder.getCompanyId();
+        list = getMapper().selectStockTakingBycondition(null,companyId);
         return list;
     }
+
+
+    public String getMaxnumber(BillCodeSeq bill) {
+        String code = maxnumberService.getMaxnumber(bill.getCaller(), false).getData();
+        DocBaseDTO base = new DocBaseDTO(0l, code, bill.getName());
+        return pushMaxnubmer(base);
+    }
+
+    public String pushMaxnubmer(DocBaseDTO baseDTO) {
+        String pi_inoutno = baseDTO.getCode();
+        String pi_class = baseDTO.getName();
+        Long id = baseDTO.getId();
+        if (null == pi_inoutno) {
+            throw new BizException(BizExceptionCode.NULL_CODE);
+        }
+        Long companyId = BaseContextHolder.getCompanyId();
+        String billCode = null;
+        synchronized (ProdInOutServiceImpl.class) {
+            Integer count = "0".equals(String.valueOf(id)) ? prodInOutMapper.validateCodeWhenInsert(pi_inoutno, companyId) :
+                    prodInOutMapper.validateCodeWhenUpdate(pi_inoutno, id, companyId);
+            String caller ="";
+            if("其它入库单".equals(pi_class)){
+                caller = BillCodeSeq.OTHERIN.getCaller();
+            }else if("其它出库单".equals(pi_class)) {
+                caller = BillCodeSeq.OTHEROUT.getCaller();
+            }
+            billCode = maxnumberService.pushMaxnubmer(count, pi_inoutno, caller).getData();
+        }
+        return billCode;
+    }
+
+
 }

+ 18 - 1
applications/storage/storage-server/src/main/resources/mapper/StockTakingMapper.xml

@@ -238,11 +238,28 @@
         ${con}
       </if>
       <if test="companyId != null">
-        and  companyId = #{companyId}
+      and companyId = #{companyId}
       </if>
+
     </where>
     order by st_id desc
   </select>
 
+  <delete id="deleteByCompany" parameterType="long">
+    delete from stocktaking
+    where companyId = #{companyId,jdbcType=INTEGER}
+  </delete>
+
+  <insert id="insertFormProductWh">
+    insert into stocktaking (st_prodid,st_prodcode,st_proddetail,st_prodorispeccode,st_prodkind,st_produnit,st_whid,st_whcode,st_whname,st_batchqty,companyId)
+    select pr_id,pr_code,pr_detail,pr_orispeccode,pr_kind,pr_unit,wh_id,wh_code,wh_description,pw_onhand,#{companyId} from productwh left join product on pw_prodid = pr_id  left join warehouse on pw_whid = wh_id
+    where productwh.companyid=#{companyId,jdbcType=INTEGER} and product.companyid =#{companyId,jdbcType=INTEGER} and warehouse.companyId=#{companyId,jdbcType=INTEGER}
+    and ${con}
+  </insert>
+
+  <select id="getPurcpriceByProduct"  resultType="double">
+    select pr_purcprice from product where pr_id = #{id}
+  </select>
+
 
 </mapper>

+ 2 - 2
frontend/saas-web/app/view/core/form/FormPanel.js

@@ -421,8 +421,8 @@ Ext.define('saas.view.core.form.FormPanel', {
         var me = this;
         var viewModel = me.getViewModel();
         var formItems = me.formItems;
-        var valid = !!Ext.Array.findBy(formItems, function(f) {
-            return f.isValid();
+        var valid = !Ext.Array.findBy(formItems, function(f) {
+            return !f.isValid();
         });
         var detailGrids = me.query('detailGridField');
 

+ 2 - 0
frontend/saas-web/app/view/core/form/field/ConDateField.js

@@ -61,6 +61,7 @@ Ext.define('saas.view.core.form.field.ConDateField', {
             allowBlank: allowBlank,
             flex: 1,
             fieldStyle: me.fieldStyle,
+            emptyText: '起始时间',
             //matchFieldWidth:true,
             listeners: {
                 change: function(f){
@@ -95,6 +96,7 @@ Ext.define('saas.view.core.form.field.ConDateField', {
             formatText: '',
             flex: 1,
             fieldStyle: me.fieldStyle,
+            emptyText: '结束时间',
             listeners: {
                 change: function(){
                     var from = me.from.value, to =me.to.value;

+ 5 - 5
frontend/saas-web/app/view/home/InfoCard.js

@@ -39,31 +39,31 @@ Ext.define('saas.view.home.InfoCard', {
         Ext.apply(me, {
             cards: {
                 unship: {
-                    title: '七天内待出货销售',
+                    title: '未出货销售订单',
                     color: 'yellow',
                     viewType: 'sale-sale-querypanel',
                     condition: 'sale.companyid=' + companyId + ' and sa_statuscode=\'AUDITED\' and exists (select 1 from saledetail detail where sd_id=saledetail.sd_id and  IFNULL(sd_sendqty,0)<ifnull(sd_qty,0) and TO_DAYS(sd_delivery)-TO_DAYS(now())<= 7)'
                 },
                 unstorage: {
-                    title: '七天内待入库采购',
+                    title: '未入库采购订单',
                     color: 'purple',
                     viewType: 'purchase-purchase-querypanel',
                     condition: 'purchase.companyId=' + companyId + ' and pu_statuscode=\'AUDITED\' and exists (select 1 from purchasedetail detail where pd_id=purchasedetail.pd_id and IFNULL(pd_acceptqty,0) < ifnull(pd_qty,0) and TO_DAYS(PD_DELIVERY)-TO_DAYS(now()) <= 7)'
                 },
                 unpay: {
-                    title: '七天内待付款',
+                    title: '未收款出货',
                     color: 'red',
                     viewType: 'purchase-purchasein-querypanel',
                     condition: 'pi_class in(\'采购验收单\',\'采购验退单\') and prodinout.companyId=' + companyId + ' and TO_DAYS(pi_date+ifnull(ve_promisedays,0))-TO_DAYS(now()) <= 7 and exists (select 1 from subledger where sl_code=pi_inoutno and sl_kind=pi_class and subledger.companyId=' + companyId + ' and ifnull(sl_namount,0)<>0)'
                 },
                 unreceive: {
-                    title: '七天内待收款',
+                    title: '未审核出货单',
                     color: 'pink',
                     viewType: 'sale-saleout-querypanel',
                     condition: 'pi_class in(\'出货单\',\'销售退货单\') and prodinout.companyId=' + companyId + ' and TO_DAYS(pi_date+ifnull(cu_promisedays,0))-TO_DAYS(now()) <= 7 and exists (select 1 from subledger where sl_code=pi_inoutno and sl_kind=pi_class and subledger.companyId=' + companyId + ' and ifnull(sl_namount,0)<>0)'
                 },
                 unauditcheck: {
-                    title: '未审核验收',
+                    title: '未审核验收',
                     color: 'blue',
                     viewType: 'purchase-purchasein-querypanel',
                     condition: 'pi_statuscode<>\'AUDITED\' and pi_class=\'采购验收单\' and prodinout.companyId=' + companyId

+ 1 - 1
frontend/saas-web/app/view/home/charts/PurchaseTrend.js

@@ -81,7 +81,7 @@ Ext.define('saas.view.home.charts.PurchaseTrend', {
                     style: {
                         lineWidth: 0,
                         strokeStyle: 'transparent',
-                        maxBarWidth: 50,
+                        maxBarWidth: 30,
                     },
                 }]
             }]

+ 1 - 1
frontend/saas-web/app/view/home/charts/StockAmount.js

@@ -75,7 +75,7 @@ Ext.define('saas.view.home.charts.StockAmount', {
                     style: {
                         lineWidth: 0,
                         strokeStyle: 'transparent',
-                        maxBarWidth: 50,
+                        maxBarWidth: 30,
                     },
                 }]
             }]

+ 1 - 1
frontend/saas-web/app/view/money/fundtransfer/QueryPanel.js

@@ -138,7 +138,7 @@ Ext.define('saas.view.money.fundtransfer.QueryPanel', {
             width: 110
         }, {
             text: '备注',
-            dataIndex: 'ft_remark',
+            dataIndex: 'ftd_remark',
             width: 250
         } ],
         relativeColumn: []

+ 1 - 1
frontend/saas-web/app/view/money/recBalance/QueryPanel.js

@@ -103,7 +103,7 @@ Ext.define('saas.view.money.recBalance.QueryPanel', {
             width: 110
         }, {
             text: '备注',
-            dataIndex: 'rd_remark',
+            dataIndex: 'rb_remark',
             width: 250
         }]
     },

+ 0 - 1
frontend/saas-web/app/view/money/report/AccountBalance.js

@@ -102,6 +102,5 @@ Ext.define('saas.view.money.report.AccountBalance', {
             text: '备注',
             dataIndex: 'remark',
             width: 250,
-            flex:1
         }]
 });

+ 1 - 1
frontend/saas-web/app/view/money/report/CustomerCheck.js

@@ -7,7 +7,7 @@ Ext.define('saas.view.money.report.CustomerCheckCheck', {
 
     viewName: 'money-report-customercheck',
 
-    groupField: null,
+    groupField: 'pi_custname',
     listUrl: '/api/money/report/customercheck',
     defaultCondition: null,
     reportTitle: '客户对账单',

+ 9 - 2
frontend/saas-web/app/view/money/report/RecDetail.js

@@ -7,7 +7,7 @@ Ext.define('saas.view.money.report.RecDetail', {
 
     viewName: 'money-report-recdetail',
 
-    groupField: null,
+    groupField: 'pi_custname',
     listUrl: '/api/money/report/recDetail',
     defaultCondition: null,
     reportTitle: '应收账款明细',
@@ -124,7 +124,14 @@ Ext.define('saas.view.money.report.RecDetail', {
             text: '单据总金额',
             dataIndex: 'pi_total',
             xtype: 'numbercolumn',
-            width: 110
+            width: 110,
+            summaryType: 'sum',
+            summaryRenderer: function(v) {
+                var arr = (v + '.').split('.');
+                var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
+                var format = '0,000.' + xr.join();
+                return Ext.util.Format.number(v, format);
+            }
         }, {
             text: '备注',
             dataIndex: 'pd_unit',

+ 1 - 1
frontend/saas-web/app/view/money/report/VendorCheck.js

@@ -7,7 +7,7 @@ Ext.define('saas.view.money.report.VendorCheck', {
 
     viewName: 'money-report-vendorcheck',
 
-    groupField: null,
+    groupField: 'pi_vendname',
     listUrl: '/api/money/report/vendorCheck',
     defaultCondition: null,
     reportTitle: '供应商对账单',

+ 107 - 31
frontend/saas-web/app/view/stock/inventory/EditDataList.js

@@ -1,12 +1,16 @@
 Ext.define('saas.view.stock.inventory.EditDataList', {
     extend: 'Ext.grid.Panel',
     xtype: 'stock-inventory-editdatalist',
+    viewModel: 'stock-inventory-editdatalist',
+
 
     autoScroll: true,
     frame:true,
     layout:'fit',
     dataUrl:'/api/storage/stocktaking/list',
     saveUrl:'/api/storage/stocktaking/save',
+    buildUrl:'/api/storage/stocktaking/build',
+    stockUrl:'/api/storage/stocktaking/stock',
     requires: [
         'Ext.Action',
         'Ext.grid.plugin.CellEditing',
@@ -22,12 +26,21 @@ Ext.define('saas.view.stock.inventory.EditDataList', {
             }
         }
     },
-    tbar: [{		
+    tbar: [{
+        xtype: 'hidden',
+        name: 'wh_id',
+        bind:'{wh_id}',
+        fieldLabel: 'wh_id'
+    },{
+        xtype: 'hidden',
+        name: 'wh_code',
+        fieldLabel: 'wh_code'
+    },{		
         xtype: 'warehouseDbfindTrigger',
         name: 'wh_description',
         emptyText: '仓库',
         dbfinds:[{
-            from:'id',to:'id',ignore:true 
+            from:'id',to:'wh_id',ignore:true 
         }, { 
             from:'wh_code',to:'wh_code'
         }, {
@@ -38,7 +51,8 @@ Ext.define('saas.view.stock.inventory.EditDataList', {
         editable:false,
         xtype : "remotecombo", 
         storeUrl:'/api/document/producttype/getCombo',
-        name : "pr_kind", 
+        name : "pr_kind",
+        bind:'{pr_kind}', 
         emptyText : "类型", 
         allowBlank : false, 
         addHandler:function(b){
@@ -59,15 +73,24 @@ Ext.define('saas.view.stock.inventory.EditDataList', {
             this.dialog.show();
         },
         width:150
-    }, {
+    },{
+        xtype: 'hidden',
+        name: 'pr_id',
+        bind:'{pr_id}',
+        fieldLabel: 'pr_id'
+    },{
+        xtype: 'hidden',
+        name: 'pr_code',
+        fieldLabel: 'pr_code'
+    },{
         xtype: 'productDbfindTrigger',
         name: 'pr_detail',
         emptyText:'输入物料编号或名称',
-        width:150,
+        width:200,
         dbfinds:[{
-            from:'pr_detail',to:'pr_detail',
+            from:'id',to:'pr_id',ignore:true
         },{
-            from:'pr_code',to:'pd_prodcode',
+            from:'pr_code',to:'pr_code',
         }, {
             from:'pr_detail',to:'pr_detail'
         }]
@@ -77,19 +100,8 @@ Ext.define('saas.view.stock.inventory.EditDataList', {
         text:'查询',
         listeners: {
             click:function(b){
-                var grid = b.ownerCt.ownerCt;
-                var tbar = b.ownerCt;
-                grid.condition = '';
-                var items = [];
-                var fields = tbar.items.items.map(f => f.name);
-                Ext.each(fields, function(f, index){
-                    var field = tbar.down('[name='+f+']');
-                    if(field){
-                        items.push(field);
-                    }
-                });
-                grid.condition = grid.getCondition(items);
-                grid.store.loadPage(1);
+                var me =this.ownerCt.ownerCt;
+                me.onbuild();
             }
         }
     },'->',{
@@ -114,7 +126,9 @@ Ext.define('saas.view.stock.inventory.EditDataList', {
         text:'生成盘点单据',
         listeners: {
             click:function(b){
-             
+                var me = this.ownerCt.ownerCt;
+                me.onStocking();
+                
             }
         }
     }],
@@ -294,14 +308,12 @@ Ext.define('saas.view.stock.inventory.EditDataList', {
     getCondition: function(items) {
         var me = this,
         conditions = [];
-
         for(var i = 0; i < items.length; i++) {
             var item = items[i];
             var field = item.name,
             func = item.getCondition,
             value = item.value,
             condition;
-
             if(typeof func == 'function') {
                 condition = {
                     type: 'condition',
@@ -343,7 +355,6 @@ Ext.define('saas.view.stock.inventory.EditDataList', {
 
         return type;
     },
-
     getDefaultFieldOperation: function(xtype) {
         var operation;
 
@@ -361,7 +372,6 @@ Ext.define('saas.view.stock.inventory.EditDataList', {
 
         return operation;
     },
-
     /**
      * 处理部分字段值
      */
@@ -386,20 +396,87 @@ Ext.define('saas.view.stock.inventory.EditDataList', {
 
         return conditionValue;
     },
-
     refresh:function(){
-        //debugger
-        var me = this,
+        var me = this;
+        // me.onbuild();
+        me.reload();
+    },
+    reload:function(){
+        var me = this;    
         store = me.getStore();
         store.load();
     },
+    onStocking:function(){
+        var me = this;
+        saas.util.BaseUtil.request({
+            url: me.stockUrl,
+            method: 'GET',
+        })
+        .then(function(localJson) {
+            if(localJson.success){
+                // me.refresh();
+                var intValue = localJson.data.inData.id,
+                codeValue= localJson.data.inData.code,
+                name = localJson.data.inData.name;
+                saas.util.BaseUtil.openTab('stock-otherin-formpanel',name+"("+codeValue+")",codeValue+intValue, {
+                    initId: intValue
+                });
+        
+                intValue = localJson.data.outData.id;
+                codeValue= localJson.data.outData.code;
+                name = localJson.data.outData.name;
+                saas.util.BaseUtil.openTab('stock-otherout-formpanel',name+"("+codeValue+")",codeValue+intValue, {
+                    initId: intValue
+                });
+            }
+        })
+        .catch(function(res) {
+            console.error(res);
+            saas.util.BaseUtil.showToast('生成盘点单失败: ' + res.message);
+        });    
+    },
+    onbuild:function(){
+        var me =this;
+        var grid = me;
+        var tbar = me.dockedItems.items[2];
+        var data;
+        grid.condition = '';
+        var items = [];
+        var fields = tbar.items.items.map(f => f.name);
+        Ext.each(fields, function(f, index){
+            var field = tbar.down('[name='+f+']');
+            if(field){
+                items.push(field);
+            }
+        });
+        grid.condition = grid.getCondition(items);
+
+        var data = grid.condition;
+        param = {
+            mode:'MAIN',
+            condition: JSON.stringify(data)
+        }
+        saas.util.BaseUtil.request({
+            url: me.buildUrl,
+            params: JSON.stringify(param),
+            method: 'POST',
+        })
+        .then(function(localJson) {
+            if(localJson.success){
+                me.reload();
+            }
+        })
+        .catch(function(res) {
+            console.error(res);
+            saas.util.BaseUtil.showToast('保存失败: ' + res.message);
+        });        
+    },
     onSave:function(){
         var me = this,
         gridData = me.getDirtyData();
         if(gridData==null){
             saas.util.BaseUtil.showToast('未修改数据');
         }
-
         saas.util.BaseUtil.request({
             url: me.saveUrl,
             params: JSON.stringify(gridData),
@@ -407,7 +484,7 @@ Ext.define('saas.view.stock.inventory.EditDataList', {
         })
         .then(function(localJson) {
             if(localJson.success){
-                me.refresh();
+                me.reload();
             }
         })
         .catch(function(res) {
@@ -424,7 +501,6 @@ Ext.define('saas.view.stock.inventory.EditDataList', {
         Ext.Array.each(allData, function(item){
             var d = Object.assign({}, item.data),
             dirty = item.dirty;
-
             if(dirty){
                 if((typeof d.id) != "number" && d.id.indexOf('-')>-1){
                     d.id = 0;

+ 5 - 0
frontend/saas-web/app/view/stock/inventory/EditDataListModel.js

@@ -0,0 +1,5 @@
+Ext.define('saas.view.stock.inventory.EditDataListModel', {
+    extend: 'Ext.app.ViewModel',
+    alias: 'viewmodel.stock-inventory-editdatalist',
+    
+});

+ 1 - 1
frontend/saas-web/app/view/stock/make/FormPanel.js

@@ -293,7 +293,7 @@ Ext.define('saas.view.stock.make.FormPanel', {
                     minValue:0
                 },
                 listeners:{
-                    edit:'price_change'
+                    // edit:'price_change'
                 },
                 renderer : function(v) {
                     var arr = (v + '.').split('.');

+ 7 - 7
frontend/saas-web/app/view/stock/make/FormPanelController.js

@@ -81,13 +81,13 @@ Ext.define('saas.view.stock.make.FormPanelController', {
     },
 
 
-    price_change:function() {
-        var me = this,
-        viewModel = me.getViewModel(),
-        store = viewModel.get('detail0').detailStore;
-        var sum_qty = store.sum('mm_price');
-        viewModel.set('ma_price',sum_qty);
-    },
+    // price_change:function() {
+    //     var me = this,
+    //     viewModel = me.getViewModel(),
+    //     store = viewModel.get('detail0').detailStore;
+    //     var sum_qty = store.sum('mm_price');
+    //     viewModel.set('ma_price',sum_qty);
+    // },
 
 
      getBomData: function(v) {

+ 1 - 1
frontend/saas-web/app/view/stock/otherIn/FormPanel.js

@@ -72,7 +72,7 @@ Ext.define('saas.view.stock.otherIn.FormPanel', {
         xtype: 'vendorDbfindTrigger',
         name: 'pi_vendname',
         fieldLabel: '供应商名称',
-        allowBlank : false,
+        allowBlank : true,
     },{
         xtype : "datefield", 
         name : "pi_date", 

+ 1 - 1
frontend/saas-web/app/view/stock/otherOut/FormPanel.js

@@ -56,7 +56,7 @@ Ext.define('saas.view.stock.otherOut.FormPanel', {
         xtype: 'customerDbfindTrigger',
         name: 'pi_custname',
         bind: '{pi_custname}',
-        allowBlank : false,
+        allowBlank : true,
         fieldLabel: '客户名称'
     }, {
         xtype: "datefield",