zhuth 7 years ago
parent
commit
b67a14582d
23 changed files with 787 additions and 144 deletions
  1. 13 13
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/ProdInOutServiceImpl.java
  2. 5 5
      applications/sale/sale-server/src/main/resources/mapper/ProdInOutListMapper.xml
  3. 8 0
      applications/storage/storage-dto/src/main/java/com/usoftchina/saas/storage/dto/MakeListDTO.java
  4. 13 3
      applications/storage/storage-dto/src/main/java/com/usoftchina/saas/storage/po/Make.java
  5. 3 3
      applications/storage/storage-dto/src/main/java/com/usoftchina/saas/storage/po/MakeMaterial.java
  6. 29 0
      applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/controller/MakeController.java
  7. 2 0
      applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/mapper/MakeMapper.java
  8. 36 0
      applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/MakeService.java
  9. 355 6
      applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/impl/MakeServiceImpl.java
  10. 18 3
      applications/storage/storage-server/src/main/resources/mapper/MakeMapper.xml
  11. 21 7
      applications/storage/storage-server/src/main/resources/mapper/MakematerialMapper.xml
  12. 41 0
      frontend/saas-web/app/view/home/Home.scss
  13. 2 2
      frontend/saas-web/app/view/sale/sale/FormPanelController.js
  14. 5 0
      frontend/saas-web/app/view/sale/sale/QueryPanel.js
  15. 75 33
      frontend/saas-web/app/view/sale/sale/QueryPanelController.js
  16. 6 1
      frontend/saas-web/app/view/sale/saleIn/FormPanel.js
  17. 15 3
      frontend/saas-web/app/view/sale/saleIn/FormPanelController.js
  18. 19 7
      frontend/saas-web/app/view/sale/saleIn/QueryPanel.js
  19. 70 39
      frontend/saas-web/app/view/sale/saleIn/QueryPanelController.js
  20. 6 1
      frontend/saas-web/app/view/sale/saleOut/FormPanel.js
  21. 16 5
      frontend/saas-web/app/view/sale/saleOut/FormPanelController.js
  22. 15 6
      frontend/saas-web/app/view/sale/saleOut/QueryPanel.js
  23. 14 7
      frontend/saas-web/app/view/sale/saleOut/QueryPanelController.js

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

@@ -134,7 +134,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
             setTotal(prodInOutNow);
             baseDTO = getBaseDTOById(pi_id,pi_class,pi_inoutno);
             //日志记录
-            //messageLogService.save(baseDTO);
+            messageLogService.save(baseDTO);
             return baseDTO;
         }
         //更新操作
@@ -168,7 +168,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         //更新明细金额等
         setTotal(prodInOutNow);
         //日志
-       //messageLogService.update(baseDTO);
+       messageLogService.update(baseDTO);
         return baseDTO;
 
     }
@@ -193,7 +193,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         //更新明细金额等
         setTotal(prodInOut);
         //日志
-      //messageLogService.deleteDetail(docBaseDTO);
+      messageLogService.deleteDetail(docBaseDTO);
     }
 
     @Override
@@ -205,7 +205,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         setTotal(prodInOut);
         DocBaseDTO docBaseDTO = getBaseDTOById(id,prodInOut.getPi_class(),prodInOut.getPi_inoutno());
         //日志
-       //messageLogService.deleteDetail(docBaseDTO);
+       messageLogService.deleteDetail(docBaseDTO);
         return num;
     }
 
@@ -264,7 +264,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
             //记录日志
             DocBaseDTO docBaseDTO = getBaseDTOById(prodInOutDTO.getId(),pi_class,pi_inoutno);
             //日志
-           //messageLogService.audit(docBaseDTO);
+           messageLogService.audit(docBaseDTO);
         }
     }
     @Override
@@ -316,7 +316,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
             //记录日志
             DocBaseDTO docBaseDTO = getBaseDTOById(prodInOutDTO.getId(),pi_class,pi_inoutno);
             //日志
-            //messageLogService.unAudit(docBaseDTO);
+            messageLogService.unAudit(docBaseDTO);
         }
     }
 
@@ -406,8 +406,8 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         ProdInOut targetPi = new ProdInOut();
         //生成单号
         String piInoutno  =
-                //maxnumberService.getMaxnumber(BillCodeSeq.SALEIN.getCaller(),true).getData();
-                BillCodeSeq.SALEIN.getCaller()+Math.abs(Math.random()*100);
+                maxnumberService.getMaxnumber(BillCodeSeq.SALEIN.getCaller(),true).getData();
+               // BillCodeSeq.SALEIN.getCaller()+Math.abs(Math.random()*100);
 
         //设置公司id
         targetPi.setCompanyId(sourcePi.getCompanyId());
@@ -479,7 +479,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
 
         //日志记录
         DocBaseDTO baseDTO = new DocBaseDTO(pi_id, piInoutno, BillCodeSeq.SALEIN.getName());
-        //messageLogService.customizeLog(baseDTO, Operation.TURNPRODOUTRETURN);
+        messageLogService.customizeLog(baseDTO, Operation.TURNPRODOUTRETURN);
         return baseDTO;
 
     }
@@ -500,7 +500,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         prodInOutMapper.updateByPrimaryKeySelective(prodInOut);
         //记录日志
         DocBaseDTO docBaseDTO = getBaseDTOById(prodInOut.getId(),prodInOut.getPi_class(),prodInOut.getPi_inoutno());
-        //messageLogService.close(docBaseDTO);
+        messageLogService.close(docBaseDTO);
         return docBaseDTO;
     }
 
@@ -535,7 +535,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         prodInOutMapper.updateByPrimaryKeySelective(prodInOut);
         //记录日志
         DocBaseDTO docBaseDTO = getBaseDTOById(prodInOut.getId(),prodInOut.getPi_class(),prodInOut.getPi_inoutno());
-        //messageLogService.open(docBaseDTO);
+        messageLogService.open(docBaseDTO);
         return docBaseDTO;
     }
 
@@ -578,8 +578,8 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         }else {//销售退货单
             caller = BillCodeSeq.SALEIN.getCaller();
         }
-        return code;
-                //maxnumberService.pushMaxnubmer(count, code, caller).getData();
+        return //code;
+                maxnumberService.pushMaxnubmer(count, code, caller).getData();
     }
 
     /**

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

@@ -76,25 +76,25 @@
 
 
   <select id="selectProdInOutListByCondition" resultMap="BaseResultMap">
-    select  *  from prodinout left join prodiodetail on pi_id = pd_piid
+    select  *  from prodinout
     <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
+        and companyId = #{companyId}
+      </if> order by pi_date desc,pi_id desc
     </where>
   </select>
 
   <select id="selectProdInOutBycondition"  resultMap="BaseResultMap">
-    select  *  from prodinout
+    select  *  from prodinout left join prodiodetail on pi_id = pd_piid left join product on pr_id = pd_prodid
       <where>
         <if test="con != null">
           ${con}
         </if>
         <if test="companyId != null">
-          and  companyId = #{companyId}
+          and  prodinout.companyId = #{companyId}
         </if>
       </where>
       order by pi_id desc

+ 8 - 0
applications/storage/storage-dto/src/main/java/com/usoftchina/saas/storage/dto/MakeListDTO.java

@@ -32,4 +32,12 @@ public class MakeListDTO extends CommonBaseDTO implements Serializable {
     public void setItems(List<MakeMaterial> items) {
         this.items = items;
     }
+
+    public MakeListDTO(Make main, List<MakeMaterial> items) {
+        this.main = main;
+        this.items = items;
+    }
+
+    public MakeListDTO() {
+    }
 }

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

@@ -14,7 +14,7 @@ public class Make extends CommonBaseEntity implements Serializable {
 
     private String ma_type;
 
-    private Integer ma_prodid;
+    private Long ma_prodid;
 
     private String ma_prodcode;
 
@@ -32,6 +32,8 @@ public class Make extends CommonBaseEntity implements Serializable {
 
     private String ma_whcode;
 
+    private String ma_whname;
+
     private Date ma_recorddate;
 
     private Integer ma_recordid;
@@ -52,6 +54,14 @@ public class Make extends CommonBaseEntity implements Serializable {
 
     private String ma_text5;
 
+    public String getMa_whname() {
+        return ma_whname;
+    }
+
+    public void setMa_whname(String ma_whname) {
+        this.ma_whname = ma_whname;
+    }
+
     public String getMa_code() {
         return ma_code;
     }
@@ -84,11 +94,11 @@ public class Make extends CommonBaseEntity implements Serializable {
         this.ma_type = ma_type == null ? null : ma_type.trim();
     }
 
-    public Integer getMa_prodid() {
+    public Long getMa_prodid() {
         return ma_prodid;
     }
 
-    public void setMa_prodid(Integer ma_prodid) {
+    public void setMa_prodid(Long ma_prodid) {
         this.ma_prodid = ma_prodid;
     }
 

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

@@ -17,7 +17,7 @@ public class MakeMaterial extends CommonBaseEntity implements Serializable {
 
     private Integer mm_detno;
 
-    private Integer mm_prodid;
+    private Long mm_prodid;
 
     private String mm_prodcode;
 
@@ -73,11 +73,11 @@ public class MakeMaterial extends CommonBaseEntity implements Serializable {
         this.mm_detno = mm_detno;
     }
 
-    public Integer getMm_prodid() {
+    public Long getMm_prodid() {
         return mm_prodid;
     }
 
-    public void setMm_prodid(Integer mm_prodid) {
+    public void setMm_prodid(Long mm_prodid) {
         this.mm_prodid = mm_prodid;
     }
 

+ 29 - 0
applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/controller/MakeController.java

@@ -1,6 +1,7 @@
 package com.usoftchina.saas.storage.controller;
 
 import com.usoftchina.saas.base.Result;
+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.page.PageRequest;
@@ -27,6 +28,18 @@ public class MakeController {
         return Result.success(makeListDTO);
     }
 
+    @PostMapping("/audit/{id}")
+    public Result audit(@PathVariable("id") Long id){
+        DocBaseDTO docBaseDTO = makeService.audit(id);
+        return Result.success(docBaseDTO);
+    }
+
+    @PostMapping("/unAudit/{id}")
+    public Result resAudit(@PathVariable("id") Long id){
+        DocBaseDTO docBaseDTO = makeService.resAudit(id);
+        return Result.success(docBaseDTO);
+    }
+
     @PostMapping("/save")
     public Result save(@RequestBody MakeListDTO makeListDTO){
         DocBaseDTO docBaseDTO = makeService.saveOrUpdate(makeListDTO);
@@ -56,4 +69,20 @@ public class MakeController {
         DocBaseDTO docBaseDTO = makeService.open(id);
         return Result.success(docBaseDTO);
     }
+
+    @PostMapping("/batchOpen")
+    public Result batchOpen(@RequestBody BatchDealBaseDTO batchDealBaseDTO){
+        return Result.success(makeService.batchOpen(batchDealBaseDTO));
+    }
+
+    @PostMapping("/batchClose")
+    public Result batchClose(@RequestBody BatchDealBaseDTO batchDealBaseDTO){
+        return Result.success(makeService.batchClose(batchDealBaseDTO));
+    }
+
+    @PostMapping("/batchDelete")
+    public Result batchDelete(@RequestBody BatchDealBaseDTO batchDealBaseDTO){
+        makeService.batchDelete(batchDealBaseDTO);
+        return Result.success();
+    }
 }

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

@@ -26,4 +26,6 @@ public interface MakeMapper extends CommonBaseMapper<Make> {
     int validateCodeWhenUpdate(@Param("code") String code, @Param("id") Long id, @Param("companyId") Long company);
 
     double getOnHand(@Param("prodcode") String prodcode, @Param("whcode") String whcode, @Param("companyId") Long companyId);
+
+    String selectMakeInOutCode(@Param("code") String code, @Param("companyId") Long companyId, @Param("type") String type);
 }

+ 36 - 0
applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/MakeService.java

@@ -3,6 +3,7 @@ package com.usoftchina.saas.storage.service;
 
 import com.github.pagehelper.PageInfo;
 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.ListReqDTO;
 import com.usoftchina.saas.page.PageRequest;
@@ -64,4 +65,39 @@ public interface MakeService extends CommonBaseService<MakeMapper, Make> {
      * @return
      */
     boolean deleteDetail(Long id);
+
+    /**
+     * 审核
+     * @param id
+     * @return
+     */
+    DocBaseDTO audit(Long id);
+
+    /**
+     * 反审核
+     * @param id
+     * @return
+     */
+    DocBaseDTO resAudit(Long id);
+
+    /**
+     * 批量关闭
+     * @param batchDealBaseDTO
+     * @return
+     */
+    String batchClose(BatchDealBaseDTO batchDealBaseDTO);
+
+    /**
+     * 批量开启
+     * @param batchDealBaseDTO
+     * @return
+     */
+    String batchOpen(BatchDealBaseDTO batchDealBaseDTO);
+
+    /**
+     * 批量删除
+     * @param batchDealBaseDTO
+     * @return
+     */
+    boolean batchDelete(BatchDealBaseDTO batchDealBaseDTO);
 }

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

@@ -2,30 +2,36 @@ package com.usoftchina.saas.storage.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.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.document.api.WarehouseApi;
 import com.usoftchina.saas.exception.BizException;
 import com.usoftchina.saas.page.PageRequest;
 import com.usoftchina.saas.storage.dto.MakeListDTO;
 import com.usoftchina.saas.storage.mapper.MakeMapper;
 import com.usoftchina.saas.storage.mapper.MakeMaterialMapper;
+import com.usoftchina.saas.storage.mapper.ProdIODetailMapper;
+import com.usoftchina.saas.storage.mapper.ProdInOutMapper;
 import com.usoftchina.saas.storage.po.Make;
 import com.usoftchina.saas.storage.po.MakeMaterial;
+import com.usoftchina.saas.storage.po.ProdIODetail;
+import com.usoftchina.saas.storage.po.ProdInOut;
 import com.usoftchina.saas.storage.service.MakeService;
 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.ArrayList;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 
 @Service
 public class MakeServiceImpl extends CommonBaseServiceImpl<MakeMapper, Make> implements MakeService {
@@ -36,6 +42,12 @@ public class MakeServiceImpl extends CommonBaseServiceImpl<MakeMapper, Make> imp
     private MaxnumberService maxnumberService;
     @Autowired
     private MessageLogService messageLogService;
+    @Autowired
+    private ProdInOutMapper prodInOutMapper;
+    @Autowired
+    private ProdIODetailMapper prodIODetailMapper;
+    @Autowired
+    private WarehouseApi warehouseApi;
 
     @Override
     public PageInfo<Make> getList(PageRequest page, ListReqDTO listReqDTO) {
@@ -66,9 +78,6 @@ public class MakeServiceImpl extends CommonBaseServiceImpl<MakeMapper, Make> imp
     @Override
     @Transactional
     public DocBaseDTO saveOrUpdate(MakeListDTO makeListDTO) {
-        //校验库存是否足够
-        validStorage(makeListDTO);
-
         Make make = makeListDTO.getMain();
         List<MakeMaterial> makeMaterialList = makeListDTO.getItems();
         DocBaseDTO docBaseDTO = null;
@@ -217,6 +226,346 @@ public class MakeServiceImpl extends CommonBaseServiceImpl<MakeMapper, Make> imp
         return true;
     }
 
+    @Override
+    @Transactional
+    public DocBaseDTO audit(Long id) {
+        //1.获取主从表数据
+        Make make = getMapper().selectByPrimaryKey(id);
+        List<MakeMaterial> items = makeMaterialMapper.selectByFK(id, BaseContextHolder.getCompanyId());
+        MakeListDTO makeListDTO = new MakeListDTO(make, items);
+        //2.校验库存是否足够
+        validStorage(makeListDTO);
+        //3.生成  完工入库单和领料单 并 过账
+        generateProdIO(makeListDTO);
+        //4.修改单据状态
+        Make updateMake = new Make();
+        make.setMa_status(Status.AUDITED.getDisplay());
+        make.setMa_statuscode(Status.AUDITED.name());
+        make.setUpdateTime(new Date());
+        make.setUpdaterId(BaseContextHolder.getUserId());
+        DocBaseDTO docBaseDTO = generateMsgObj(id, make.getMa_code());
+        //5.记录LOG
+        messageLogService.audit(docBaseDTO);
+        return docBaseDTO;
+    }
+
+    /**
+     * 1.生成  完工入库单和生产领料单
+     * 2.过账
+     * @param makeListDTO
+     */
+    private void generateProdIO(MakeListDTO makeListDTO) {
+        Make make = makeListDTO.getMain();
+        List<MakeMaterial> items = makeListDTO.getItems();
+        if ("组装".equals(make.getMa_type())){
+            /** 1.生产领料单 **/
+            //a.主表
+            ProdInOut prodInOut = new ProdInOut();
+            prodInOut.setPi_class("生产领料单");
+            String code = maxnumberService.getMaxnumber("MakeOut", true).getData();
+            prodInOut.setPi_inoutno(code);
+            prodInOut.setPi_date(new Date());       //出入库日期
+            //prodInOut.setPi_total(make.getMa_price());
+            prodInOut.setPi_recordmanid(BaseContextHolder.getUserId());     //录入人ID
+            prodInOut.setPi_recorddate(new Date());     //录入日期
+            prodInOut.setPi_auditdate(new Date());      //审核日期
+            prodInOut.setPi_auditman("");               //审核人
+            prodInOut.setPi_status(Status.UNAUDITED.getDisplay());  //单据状态
+            prodInOut.setPi_statuscode(Status.UNAUDITED.name());    //单据状态码
+            prodInOut.setPi_text1(make.getMa_code());       //自定义字段1   赋值为制造单号
+            prodInOut.setCompanyId(BaseContextHolder.getCompanyId());   //公司ID
+            prodInOut.setCreateTime(new Date());
+            prodInOut.setCreatorId(BaseContextHolder.getUserId());      //创建人ID
+            prodInOutMapper.insertSelective(prodInOut);
+            long pi_id = prodInOut.getId();
+            //b.从表
+            List<ProdIODetail> prodIODetailList = new ArrayList<ProdIODetail>();
+            int detno = 0;
+            for (MakeMaterial item : items){
+                detno++;
+                ProdIODetail prodIODetail = new ProdIODetail();
+                prodIODetail.setPd_piid(pi_id);     //主表ID
+                prodIODetail.setPd_piclass("生产领料单");
+                prodIODetail.setPd_inoutno(code);       //出入库单号
+                prodIODetail.setPd_pdno(detno);         //出入库单序号
+                prodIODetail.setPd_ordercode(make.getMa_code());    //订单号
+                prodIODetail.setPd_orderdetno(item.getMm_detno());  //订单序号
+                prodIODetail.setPd_prodid(item.getMm_prodid());    //物料ID
+                prodIODetail.setPd_prodcode(item.getMm_prodcode()); //物料CODE
+                prodIODetail.setPd_outqty(item.getMm_qty());        //出库数
+                prodIODetail.setPd_price(item.getMm_price());       //成本单价 ???
+                prodIODetail.setPd_total(item.getMm_amount());      //金额
+                prodIODetail.setPd_whid(item.getMm_whid());         //仓库ID
+                prodIODetail.setPd_whcode(item.getMm_whcode());     //仓库CODE
+                prodIODetail.setPd_whname(item.getMm_whname());     //仓库名称
+                prodIODetail.setCompanyId(BaseContextHolder.getCompanyId());    //公司ID
+                prodIODetail.setPd_status(0);      //单据状态
+                prodIODetailList.add(prodIODetail);
+            }
+            prodIODetailMapper.batchInsert(prodIODetailList);
+
+            //c.领料单过账
+            Map<String, Object> map = new HashMap<String, Object>();
+            map.put("inoutNo", code);
+            map.put("class", "生产领料单");
+            map.put("commitid", BaseContextHolder.getUserId());
+            map.put("companyId", BaseContextHolder.getCompanyId());
+            map.put("result", null);
+            Result result = warehouseApi.post(map);
+            if (!StringUtils.isEmpty(result.getData())){
+                throw new BizException(76201, result.getData().toString());
+            }
+            /** 2.完工入库单 **/
+            //a.主表
+            prodInOut = new ProdInOut();
+            prodInOut.setPi_class("完工入库单");
+            code = maxnumberService.getMaxnumber("MakeIn", true).getData();
+            prodInOut.setPi_inoutno(code);
+            prodInOut.setPi_date(new Date());       //出入库日期
+            //prodInOut.setPi_total(make.getMa_price());
+            prodInOut.setPi_recordmanid(BaseContextHolder.getUserId());     //录入人ID
+            prodInOut.setPi_recorddate(new Date());     //录入日期
+            prodInOut.setPi_auditdate(new Date());      //审核日期
+            prodInOut.setPi_auditman("");               //审核人
+            prodInOut.setPi_status(Status.UNAUDITED.getDisplay());  //单据状态
+            prodInOut.setPi_statuscode(Status.UNAUDITED.name());    //单据状态码
+            prodInOut.setPi_text1(make.getMa_code());       //自定义字段1   赋值为制造单号
+            prodInOut.setCompanyId(BaseContextHolder.getCompanyId());   //公司ID
+            prodInOut.setCreateTime(new Date());
+            prodInOut.setCreatorId(BaseContextHolder.getUserId());      //创建人ID
+            prodInOutMapper.insertSelective(prodInOut);
+            pi_id = prodInOut.getId();
+            //b.从表
+            ProdIODetail prodIODetail = new ProdIODetail();
+            prodIODetail.setPd_piid(pi_id);     //主表ID
+            prodIODetail.setPd_piclass("完工入库单");
+            prodIODetail.setPd_inoutno(code);       //出入库单号
+            prodIODetail.setPd_pdno(1);         //出入库单序号
+            prodIODetail.setPd_ordercode(make.getMa_code());    //订单号
+            prodIODetail.setPd_orderdetno(1);  //订单序号
+            prodIODetail.setPd_prodid(make.getMa_prodid());    //物料ID
+            prodIODetail.setPd_prodcode(make.getMa_prodcode()); //物料CODE
+            prodIODetail.setPd_inqty(make.getMa_qty());        //入库数
+            prodIODetail.setPd_price(make.getMa_price());       //成本单价 ???
+            prodIODetail.setPd_total(make.getMa_total());      //金额
+            prodIODetail.setPd_whid(make.getMa_whid());         //仓库ID
+            prodIODetail.setPd_whcode(make.getMa_whcode());     //仓库CODE
+            prodIODetail.setPd_whname(make.getMa_whname());     //仓库名称
+            prodIODetail.setCompanyId(BaseContextHolder.getCompanyId());    //公司ID
+            prodIODetail.setPd_status(0);      //单据状态
+            prodIODetailMapper.insertSelective(prodIODetail);
+
+            map.put("inoutNo", code);
+            map.put("class", "完工入库单");
+            map.put("commitid", BaseContextHolder.getUserId());
+            map.put("companyId", BaseContextHolder.getCompanyId());
+            map.put("result", null);
+            result = warehouseApi.post(map);
+            if (!StringUtils.isEmpty(result.getData())){
+                throw new BizException(76202, result.getData().toString());
+            }
+        }else if ("拆件".equals(make.getMa_type())){
+            /** 1.生产领料单 **/
+            //a.主表
+            ProdInOut prodInOut = new ProdInOut();
+            prodInOut.setPi_class("生产领料单");
+            String code = maxnumberService.getMaxnumber("MakeOut", true).getData();
+            prodInOut.setPi_inoutno(code);
+            prodInOut.setPi_date(new Date());       //出入库日期
+            //prodInOut.setPi_total(make.getMa_price());
+            prodInOut.setPi_recordmanid(BaseContextHolder.getUserId());     //录入人ID
+            prodInOut.setPi_recorddate(new Date());     //录入日期
+            prodInOut.setPi_auditdate(new Date());      //审核日期
+            prodInOut.setPi_auditman("");               //审核人
+            prodInOut.setPi_status(Status.UNAUDITED.getDisplay());  //单据状态
+            prodInOut.setPi_statuscode(Status.UNAUDITED.name());    //单据状态码
+            prodInOut.setPi_text1(make.getMa_code());       //自定义字段1   赋值为制造单号
+            prodInOut.setCompanyId(BaseContextHolder.getCompanyId());   //公司ID
+            prodInOut.setCreateTime(new Date());
+            prodInOut.setCreatorId(BaseContextHolder.getUserId());      //创建人ID
+            prodInOutMapper.insertSelective(prodInOut);
+            long pi_id = prodInOut.getId();
+            //b.从表
+            ProdIODetail prodIODetail = new ProdIODetail();
+            prodIODetail.setPd_piid(pi_id);     //主表ID
+            prodIODetail.setPd_piclass("生产领料单");
+            prodIODetail.setPd_inoutno(code);       //出入库单号
+            prodIODetail.setPd_pdno(1);         //出入库单序号
+            prodIODetail.setPd_ordercode(make.getMa_code());    //订单号
+            prodIODetail.setPd_orderdetno(1);  //订单序号
+            prodIODetail.setPd_prodid(make.getMa_prodid());    //物料ID
+            prodIODetail.setPd_prodcode(make.getMa_code()); //物料CODE
+            prodIODetail.setPd_outqty(make.getMa_qty());        //出库数
+            prodIODetail.setPd_price(make.getMa_price());       //成本单价 ???
+            prodIODetail.setPd_total(make.getMa_total());      //金额
+            prodIODetail.setPd_whid(make.getMa_whid());         //仓库ID
+            prodIODetail.setPd_whcode(make.getMa_whcode());     //仓库CODE
+            prodIODetail.setPd_whname(make.getMa_whname());     //仓库名称
+            prodIODetail.setCompanyId(BaseContextHolder.getCompanyId());    //公司ID
+            prodIODetail.setPd_status(0);      //单据状态
+            prodIODetailMapper.insertSelective(prodIODetail);
+
+            //c.领料单过账
+            Map<String, Object> map = new HashMap<String, Object>();
+            map.put("inoutNo", code);
+            map.put("class", "生产领料单");
+            map.put("commitid", BaseContextHolder.getUserId());
+            map.put("companyId", BaseContextHolder.getCompanyId());
+            map.put("result", null);
+            Result result = warehouseApi.post(map);
+            if (!StringUtils.isEmpty(result.getData())){
+                throw new BizException(76201, result.getData().toString());
+            }
+            /** 2.完工入库单 **/
+            //a.主表
+            prodInOut = new ProdInOut();
+            prodInOut.setPi_class("完工入库单");
+            code = maxnumberService.getMaxnumber("MakeIn", true).getData();
+            prodInOut.setPi_inoutno(code);
+            prodInOut.setPi_date(new Date());       //出入库日期
+            //prodInOut.setPi_total(make.getMa_price());
+            prodInOut.setPi_recordmanid(BaseContextHolder.getUserId());     //录入人ID
+            prodInOut.setPi_recorddate(new Date());     //录入日期
+            prodInOut.setPi_auditdate(new Date());      //审核日期
+            prodInOut.setPi_auditman("");               //审核人
+            prodInOut.setPi_status(Status.UNAUDITED.getDisplay());  //单据状态
+            prodInOut.setPi_statuscode(Status.UNAUDITED.name());    //单据状态码
+            prodInOut.setPi_text1(make.getMa_code());       //自定义字段1   赋值为制造单号
+            prodInOut.setCompanyId(BaseContextHolder.getCompanyId());   //公司ID
+            prodInOut.setCreateTime(new Date());
+            prodInOut.setCreatorId(BaseContextHolder.getUserId());      //创建人ID
+            prodInOutMapper.insertSelective(prodInOut);
+            pi_id = prodInOut.getId();
+            //b.从表
+            List<ProdIODetail> prodIODetailList = new ArrayList<ProdIODetail>();
+            int detno = 0;
+            for (MakeMaterial item : items) {
+                detno++;
+                prodIODetail = new ProdIODetail();
+                prodIODetail.setPd_piid(pi_id);     //主表ID
+                prodIODetail.setPd_piclass("完工入库单");
+                prodIODetail.setPd_inoutno(code);       //出入库单号
+                prodIODetail.setPd_pdno(detno);         //出入库单序号
+                prodIODetail.setPd_ordercode(make.getMa_code());    //订单号
+                prodIODetail.setPd_orderdetno(detno);  //订单序号
+                prodIODetail.setPd_prodid(item.getMm_prodid());    //物料ID
+                prodIODetail.setPd_prodcode(item.getMm_prodcode()); //物料CODE
+                prodIODetail.setPd_inqty(item.getMm_qty());        //入库数
+                prodIODetail.setPd_price(item.getMm_price());       //成本单价 ???
+                prodIODetail.setPd_total(item.getMm_amount());      //金额
+                prodIODetail.setPd_whid(item.getMm_whid());         //仓库ID
+                prodIODetail.setPd_whcode(item.getMm_whcode());     //仓库CODE
+                prodIODetail.setPd_whname(item.getMm_whname());     //仓库名称
+                prodIODetail.setCompanyId(BaseContextHolder.getCompanyId());    //公司ID
+                prodIODetail.setPd_status(0);      //单据状态
+                prodIODetailList.add(prodIODetail);
+            }
+            prodIODetailMapper.batchInsert(prodIODetailList);
+
+            map.put("inoutNo", code);
+            map.put("class", "完工入库单");
+            map.put("commitid", BaseContextHolder.getUserId());
+            map.put("companyId", BaseContextHolder.getCompanyId());
+            map.put("result", null);
+            result = warehouseApi.post(map);
+            if (!StringUtils.isEmpty(result.getData())){
+                throw new BizException(76202, result.getData().toString());
+            }
+        }
+    }
+
+    @Override
+    @Transactional
+    public DocBaseDTO resAudit(Long id) {
+        //1.获取主从表数据
+        Make make = getMapper().selectByPrimaryKey(id);
+        List<MakeMaterial> items = makeMaterialMapper.selectByFK(id, BaseContextHolder.getCompanyId());
+        MakeListDTO makeListDTO = new MakeListDTO(make, items);
+        //2.校验库存是否足够
+        validStorage(makeListDTO);
+        //3.查找  完工入库单和领料单
+        //4.反过账
+        selectProdIO(make);
+        //5.修改单据状态
+        Make updateMake = new Make();
+        make.setMa_status(Status.UNAUDITED.getDisplay());
+        make.setMa_statuscode(Status.UNAUDITED.name());
+        make.setUpdateTime(new Date());
+        make.setUpdaterId(BaseContextHolder.getUserId());
+        DocBaseDTO docBaseDTO = generateMsgObj(id, make.getMa_code());
+        //6.记录LOG
+        messageLogService.unAudit(docBaseDTO);
+        return docBaseDTO;
+    }
+
+    @Override
+    public String batchClose(BatchDealBaseDTO batchDealBaseDTO) {
+        StringBuilder errorMsg = new StringBuilder();
+        for (DocBaseDTO docBaseDTO : batchDealBaseDTO.getBaseDTOs()){
+            try{
+                close(docBaseDTO.getId());
+            }catch (Exception e){
+                errorMsg.append("编号:" + docBaseDTO.getCode() + "处理失败," + e.getMessage());
+            }
+        }
+        return errorMsg.toString();
+    }
+
+    @Override
+    public String batchOpen(BatchDealBaseDTO batchDealBaseDTO) {
+        StringBuilder errorMsg = new StringBuilder();
+        for (DocBaseDTO docBaseDTO : batchDealBaseDTO.getBaseDTOs()){
+            try{
+                open(docBaseDTO.getId());
+            }catch (Exception e){
+                errorMsg.append("编号:" + docBaseDTO.getCode() + "处理失败," + e.getMessage());
+            }
+        }
+        return errorMsg.toString();
+    }
+
+    @Override
+    public boolean batchDelete(BatchDealBaseDTO batchDealBaseDTO) {
+        if (null == batchDealBaseDTO || null == batchDealBaseDTO.getBaseDTOs() ||
+                batchDealBaseDTO.getBaseDTOs().size() == 0) {
+            return false;
+        }
+        for (DocBaseDTO docBaseDTO : batchDealBaseDTO.getBaseDTOs()){
+            delete(docBaseDTO.getId());
+        }
+        return true;
+    }
+
+    /**
+     * 1.查找制造单关联的出入库单据
+     * 2.反过账
+     * @param make
+     */
+    private void selectProdIO(Make make) {
+        String code = make.getMa_code();
+        Long companyId = BaseContextHolder.getCompanyId();
+        String InCode = getMapper().selectMakeInOutCode(code, companyId, "完工入库单");
+        String outCode = getMapper().selectMakeInOutCode(code, companyId, "生产领料单");
+        Map<String, Object> map = new HashMap<String, Object>();
+        map.put("inoutNo", InCode);
+        map.put("class", "完工入库单");
+        map.put("commitid", BaseContextHolder.getUserId());
+        map.put("companyId", companyId);
+        map.put("result", null);
+        //完工入库单反过账
+        Result result = warehouseApi.unPost(map);
+        if(!StringUtils.isEmpty(result)){
+            throw new BizException(76203, result.getData().toString());
+        }
+        map.put("inoutNo", outCode);
+        map.put("class", "生产领料单");
+        //生产领料单反过账
+        result = warehouseApi.unPost(map);
+        if(!StringUtils.isEmpty(result)){
+            throw new BizException(76204, result.getData().toString());
+        }
+    }
+
     /**
      * 构造日记记录对象
      * @param id

+ 18 - 3
applications/storage/storage-server/src/main/resources/mapper/MakeMapper.xml

@@ -16,6 +16,7 @@
     <result column="ma_qty" property="ma_qty" jdbcType="DOUBLE" />
     <result column="ma_whid" property="ma_whid" jdbcType="INTEGER" />
     <result column="ma_whcode" property="ma_whcode" jdbcType="VARCHAR" />
+    <result column="ma_whname" property="ma_whname" jdbcType="VARCHAR" />
     <result column="ma_recorddate" property="ma_recorddate" jdbcType="TIMESTAMP" />
     <result column="ma_recordid" property="ma_recordid" jdbcType="INTEGER" />
     <result column="ma_recorder" property="ma_recorder" jdbcType="VARCHAR" />
@@ -32,7 +33,7 @@
   </resultMap>
   <sql id="Base_Column_List" >
     ma_id, ma_code, ma_status, ma_statuscode, ma_type, ma_prodid, ma_prodcode, ma_proddetail, 
-    ma_prodspec, ma_version, ma_produnit, ma_qty, ma_whid, ma_whcode, ma_recorddate, 
+    ma_prodspec, ma_version, ma_produnit, ma_qty, ma_whid, ma_whcode, ma_whname, ma_recorddate,
     ma_recordid, ma_recorder, ma_price, ma_total, companyId, updaterId, updateTime, ma_text1, 
     ma_text2, ma_text3, ma_text4, ma_text5
   </sql>
@@ -54,7 +55,7 @@
       ma_statuscode, ma_type, ma_prodid, 
       ma_prodcode, ma_proddetail, ma_prodspec, 
       ma_version, ma_produnit, ma_qty, 
-      ma_whid, ma_whcode, ma_recorddate, 
+      ma_whid, ma_whcode, ma_whname, ma_recorddate,
       ma_recordid, ma_recorder, ma_price, 
       ma_total, companyId, updaterId, 
       updateTime, ma_text1, ma_text2, 
@@ -64,7 +65,7 @@
       #{ma_statuscode,jdbcType=VARCHAR}, #{ma_type,jdbcType=VARCHAR}, #{ma_prodid,jdbcType=INTEGER}, 
       #{ma_prodcode,jdbcType=VARCHAR}, #{ma_proddetail,jdbcType=VARCHAR}, #{ma_prodspec,jdbcType=VARCHAR}, 
       #{ma_version,jdbcType=VARCHAR}, #{ma_produnit,jdbcType=VARCHAR}, #{ma_qty,jdbcType=DOUBLE}, 
-      #{ma_whid,jdbcType=INTEGER}, #{ma_whcode,jdbcType=VARCHAR}, #{ma_recorddate,jdbcType=TIMESTAMP}, 
+      #{ma_whid,jdbcType=INTEGER}, #{ma_whcode,jdbcType=VARCHAR}, #{ma_whname,jdbcType=VARCHAR}, #{ma_recorddate,jdbcType=TIMESTAMP},
       #{ma_recordid,jdbcType=INTEGER}, #{ma_recorder,jdbcType=VARCHAR}, #{ma_price,jdbcType=DOUBLE}, 
       #{ma_total,jdbcType=DOUBLE}, #{companyId,jdbcType=INTEGER}, #{updaterId,jdbcType=INTEGER}, 
       #{updateTime,jdbcType=TIMESTAMP}, #{ma_text1,jdbcType=VARCHAR}, #{ma_text2,jdbcType=VARCHAR}, 
@@ -116,6 +117,9 @@
       <if test="ma_whcode != null" >
         ma_whcode,
       </if>
+      <if test="ma_whname != null" >
+          ma_whname,
+      </if>
       <if test="ma_recorddate != null" >
         ma_recorddate,
       </if>
@@ -196,6 +200,9 @@
       <if test="ma_whcode != null" >
         #{ma_whcode,jdbcType=VARCHAR},
       </if>
+      <if test="ma_whname != null" >
+          #{ma_whname,jdbcType=VARCHAR},
+      </if>
       <if test="ma_recorddate != null" >
         #{ma_recorddate,jdbcType=TIMESTAMP},
       </if>
@@ -279,6 +286,9 @@
       <if test="ma_whcode != null" >
         ma_whcode = #{ma_whcode,jdbcType=VARCHAR},
       </if>
+      <if test="ma_whname != null" >
+        ma_whname = #{ma_whname,jdbcType=VARCHAR},
+      </if>
       <if test="ma_recorddate != null" >
         ma_recorddate = #{ma_recorddate,jdbcType=TIMESTAMP},
       </if>
@@ -336,6 +346,7 @@
       ma_qty = #{ma_qty,jdbcType=DOUBLE},
       ma_whid = #{ma_whid,jdbcType=INTEGER},
       ma_whcode = #{ma_whcode,jdbcType=VARCHAR},
+      ma_whname = #{ma_whname,jdbcType=VARCHAR},
       ma_recorddate = #{ma_recorddate,jdbcType=TIMESTAMP},
       ma_recordid = #{ma_recordid,jdbcType=INTEGER},
       ma_recorder = #{ma_recorder,jdbcType=VARCHAR},
@@ -371,4 +382,8 @@
     <select id="getOnHand" resultType="double">
         SELECT PW_ONHAND FROM PRODUCTWH WHERE PW_PRODCODE=#{prodcode} AND PW_WHCODE=#{whcode} and COMPANYID=#{companyId}
     </select>
+
+    <select id="selectMakeInOutCode" resultType="string">
+        SELECT PI_INOUTNO FROM PRODINOUT WHERE COMPANYID=#{companyId} AND PI_TEXT1=#{code} AND PI_CLASS=#{type}
+    </select>
 </mapper>

+ 21 - 7
applications/storage/storage-server/src/main/resources/mapper/MakematerialMapper.xml

@@ -9,6 +9,7 @@
     <result column="mm_prodcode" property="mm_prodcode" jdbcType="VARCHAR" />
     <result column="mm_whid" property="mm_whid" jdbcType="INTEGER" />
     <result column="mm_whcode" property="mm_whcode" jdbcType="VARCHAR" />
+    <result column="mm_whname" property="mm_whname" jdbcType="VARCHAR" />
     <result column="mm_price" property="mm_price" jdbcType="DOUBLE" />
     <result column="mm_oneuseqty" property="mm_oneuseqty" jdbcType="DOUBLE" />
     <result column="mm_qty" property="mm_qty" jdbcType="DOUBLE" />
@@ -51,7 +52,7 @@
     </association>
   </resultMap>
   <sql id="Base_Column_List" >
-    mm_id, mm_maid, mm_detno, mm_prodid, mm_prodcode, mm_whid, mm_whcode, mm_price, mm_oneuseqty, 
+    mm_id, mm_maid, mm_detno, mm_prodid, mm_prodcode, mm_whid, mm_whcode, mm_whname, mm_price, mm_oneuseqty,
     mm_qty, mm_amount, mm_repprodcode, mm_remark, companyId, updaterId, updateTime
   </sql>
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
@@ -67,13 +68,13 @@
   <insert id="insert" parameterType="com.usoftchina.saas.storage.po.MakeMaterial" >
     insert into MakeMaterial (mm_maid, mm_detno,
       mm_prodid, mm_prodcode, mm_whid, 
-      mm_whcode, mm_price, mm_oneuseqty, 
+      mm_whcode, mm_whname, mm_price, mm_oneuseqty,
       mm_qty, mm_amount, mm_repprodcode, 
       mm_remark, companyId, updaterId, 
       updateTime)
     values (#{mm_maid}, #{mm_detno,jdbcType=INTEGER},
       #{mm_prodid,jdbcType=INTEGER}, #{mm_prodcode,jdbcType=VARCHAR}, #{mm_whid,jdbcType=INTEGER}, 
-      #{mm_whcode,jdbcType=VARCHAR}, #{mm_price,jdbcType=DOUBLE}, #{mm_oneuseqty,jdbcType=DOUBLE}, 
+      #{mm_whcode,jdbcType=VARCHAR}, #{mm_whname,jdbcType=VARCHAR}, #{mm_price,jdbcType=DOUBLE}, #{mm_oneuseqty,jdbcType=DOUBLE},
       #{mm_qty,jdbcType=DOUBLE}, #{mm_amount,jdbcType=DOUBLE}, #{mm_repprodcode,jdbcType=VARCHAR}, 
       #{mm_remark,jdbcType=VARCHAR}, #{companyId,jdbcType=INTEGER}, #{updaterId,jdbcType=INTEGER}, 
       #{updateTime,jdbcType=TIMESTAMP})
@@ -99,6 +100,9 @@
       <if test="mm_whcode != null" >
         mm_whcode,
       </if>
+        <if test="mm_whname != null" >
+            mm_whname,
+        </if>
       <if test="mm_price != null" >
         mm_price,
       </if>
@@ -146,6 +150,9 @@
       <if test="mm_whcode != null" >
         #{mm_whcode,jdbcType=VARCHAR},
       </if>
+        <if test="mm_whname != null" >
+            #{mm_whname,jdbcType=VARCHAR},
+        </if>
       <if test="mm_price != null" >
         #{mm_price,jdbcType=DOUBLE},
       </if>
@@ -196,6 +203,9 @@
       <if test="mm_whcode != null" >
         mm_whcode = #{mm_whcode,jdbcType=VARCHAR},
       </if>
+        <if test="mm_whname != null" >
+            mm_whname = #{mm_whname,jdbcType=VARCHAR},
+        </if>
       <if test="mm_price != null" >
         mm_price = #{mm_price,jdbcType=DOUBLE},
       </if>
@@ -234,6 +244,7 @@
       mm_prodcode = #{mm_prodcode,jdbcType=VARCHAR},
       mm_whid = #{mm_whid,jdbcType=INTEGER},
       mm_whcode = #{mm_whcode,jdbcType=VARCHAR},
+      mm_whname = #{mm_whname,jdbcType=VARCHAR},
       mm_price = #{mm_price,jdbcType=DOUBLE},
       mm_oneuseqty = #{mm_oneuseqty,jdbcType=DOUBLE},
       mm_qty = #{mm_qty,jdbcType=DOUBLE},
@@ -254,19 +265,19 @@
   <insert id="batchInsert" parameterType="java.util.List">
       INSERT INTO MAKEMATERIAL (mm_maid, mm_detno,
       mm_prodid, mm_prodcode, mm_whid,
-      mm_whcode, mm_price, mm_oneuseqty
+      mm_whcode, mm_whname, mm_price, mm_oneuseqty,
       mm_qty, mm_amount, mm_repprodcode,
       mm_remark, companyId, updaterId,
-      updateTime,mm_whname)
+      updateTime)
       VALUES
     <foreach collection="list" item="item" index="index" open="" close="" separator=",">
       (
       #{item.mm_maid}, #{item.mm_detno,jdbcType=INTEGER},
       #{item.mm_prodid,jdbcType=INTEGER}, #{item.mm_prodcode,jdbcType=VARCHAR}, #{item.mm_whid,jdbcType=INTEGER},
-      #{item.mm_whcode,jdbcType=VARCHAR}, #{item.mm_price,jdbcType=DOUBLE}, #{item.mm_oneuseqty,jdbcType=DOUBLE},
+      #{item.mm_whcode,jdbcType=VARCHAR}, #{item.mm_whname,jdbcType=VARCHAR}, #{item.mm_price,jdbcType=DOUBLE}, #{item.mm_oneuseqty,jdbcType=DOUBLE},
       #{item.mm_qty,jdbcType=DOUBLE}, #{item.mm_amount,jdbcType=DOUBLE}, #{item.mm_repprodcode,jdbcType=VARCHAR},
       #{item.mm_remark,jdbcType=VARCHAR}, #{item.companyId,jdbcType=INTEGER}, #{item.updaterId,jdbcType=INTEGER},
-      #{item.updateTime,jdbcType=TIMESTAMP},#{item.mm_whname,jdbcType=VARCHAR}
+      #{item.updateTime,jdbcType=TIMESTAMP}
       )
     </foreach>
   </insert>
@@ -292,6 +303,9 @@
         <if test="item.mm_whcode != null" >
           mm_whcode = #{item.mm_whcode,jdbcType=VARCHAR},
         </if>
+          <if test="item.mm_whname != null" >
+              mm_whname = #{item.mm_whname,jdbcType=VARCHAR},
+          </if>
         <if test="item.mm_price != null" >
           mm_price = #{item.mm_price,jdbcType=DOUBLE},
         </if>

+ 41 - 0
frontend/saas-web/app/view/home/Home.scss

@@ -89,4 +89,45 @@ $unaudit-purc-container-color: dynamic(#e91e63);
     content: "";
     top: 0;
     left: 0
+}
+
+.x-responsivecolumn {
+    padding: 0;
+}
+
+.big-100 {
+    @include responsivecolumn-item(100%);
+}
+
+.big-60 {
+    @include responsivecolumn-item(60%);
+}
+
+.big-50 {
+    @include responsivecolumn-item(50%);
+}
+
+.big-40 {
+    @include responsivecolumn-item(40%);
+}
+
+.big-33 {
+    @include responsivecolumn-item(33.33%);
+}
+
+.big-20 {
+    @include responsivecolumn-item(20%);
+}
+
+//--------------------------------------------------------
+// And classes for small-size responsive items
+
+ .x-responsivecolumn-small {
+     > .small-100 {
+         @include responsivecolumn-item(100%);
+     }
+
+     > .small-50 {
+         @include responsivecolumn-item(50%);
+     }
 }

+ 2 - 2
frontend/saas-web/app/view/sale/sale/FormPanelController.js

@@ -14,7 +14,7 @@ Ext.define('saas.view.sale.sale.FormPanelController', {
                         defaultCondition:"cu_statuscode='OPEN'",
                         dbfinds:[
                             {
-                                from:'id',to:'sa_custid'
+                                from:'id',to:'sa_custid',ignore:true
                             },{
                                 from:'cu_code',to:'sa_custcode'
                             },{
@@ -113,7 +113,7 @@ Ext.define('saas.view.sale.sale.FormPanelController', {
                         addTitle: '物料资料',
                         dbfinds:[
                         {
-                            from:'pr_code',to:'sd_prodcode'
+                            from:'pr_code',to:'sd_prodcode',ignore:true
                         }, {
                             from:'pr_detail',to:'pr_detail'
                         }, {

+ 5 - 0
frontend/saas-web/app/view/sale/sale/QueryPanel.js

@@ -16,6 +16,11 @@ Ext.define('saas.view.sale.sale.QueryPanel', {
         xtype: 'textfield',
         name: 'sa_code',
         fieldLabel: '销售编号'
+    }, {
+        xtype: 'condatefield',
+        name: 'sa_recorddate',
+        fieldLabel: '单据日期',
+        columnWidth: 0.5
     }, {
         xtype: 'hidden',
         name: 'sa_custcode',

+ 75 - 33
frontend/saas-web/app/view/sale/sale/QueryPanelController.js

@@ -11,8 +11,9 @@ Ext.define('saas.view.sale.sale.QueryPanelController', {
                         dataUrl:'/api/document/customer/dbfind',
                         addXtype: 'document-customer-formpanel',
                         addTitle: '客户资料',
+                        defaultCondition:"cu_statuscode='OPEN'",
                         dbfinds:[{
-                            from:'cu_id',to:'sa_custid'
+                            from:'cu_id',to:'sa_custid',ignore:true
                         },{
                             from:'cu_code',to:'sa_custcode'
                         },{
@@ -23,38 +24,79 @@ Ext.define('saas.view.sale.sale.QueryPanelController', {
                         },{
                             field:'cu_name',width:100
                         }],
-                        dbColumns:[{
-                            conditionCode:'cu_id',
-                            "text": "客户ID",
-                            "flex": 0,
-                            "dataIndex": "cu_id",
-                            "width": 0,
-                            "xtype": "",
-                            "items": null
-                        },{
-                            conditionCode:'cu_code',
-                            "text": "客户编号",
-                            "flex": 1,
-                            "dataIndex": "cu_code",
-                            "width": 100,
-                            "xtype": "",
-                            "items": null
-                        }, {
-                            conditionCode:'cu_name',
-                            "text": "客户名称",
-                            "flex": 1,
-                            "dataIndex": "cu_name",
-                            "xtype": "",
-                            "items": null
-                        }, {
-                            conditionCode:'cu_type',
-                            "text": "客户类型",
-                            "flex": 0,
-                            "dataIndex": "cu_type",
-                            "width": 200,
-                            "xtype": "",
-                            "items": null
-                        }]
+                        dbSearchFields:[{
+                            emptyText:'输入客户编号或客户名称',
+                            xtype : "textfield", 
+                            name : "search", 
+                            getCondition: function(v) {
+                                return "(upper(cu_code) like '%"+v.toUpperCase()+"%' or upper(cu_name) like '%"+v.toUpperCase()+"%')";
+                            },
+                            allowBlank : true, 
+                            columnWidth : 0.25
+                        }],
+                        dbColumns:[
+                            {
+                                conditionCode:'id',
+                                "text": "客户ID",
+                                "flex": 0,
+                                "dataIndex": "id",
+                                "width": 0,
+                                "xtype": "",
+                                "items": null
+                            },{
+                                conditionCode:'cu_code',
+                                "text": "客户编号",
+                                "flex": 1,
+                                "dataIndex": "cu_code",
+                                "width": 100,
+                                "xtype": "",
+                                "items": null
+                            }, {
+                                conditionCode:'cu_name',
+                                "text": "客户名称",
+                                "flex": 1,
+                                "dataIndex": "cu_name",
+                                "xtype": "",
+                                "items": null
+                            }, {
+                                conditionCode:'cu_type',
+                                "text": "客户类型",
+                                "flex": 1,
+                                "dataIndex": "cu_type",
+                                "width": 200,
+                                "xtype": "",
+                                "items": null
+                            }, {
+                                "text": "业务员编号",
+                                "flex": 1,
+                                "dataIndex": "cu_sellercode",
+                                "width": 100
+                            }, {
+                                "text": "业务员",
+                                "flex": 1,
+                                "dataIndex": "cu_sellername",
+                                "width": 100
+                            }, {
+                                "text": "税率",
+                                "flex": 1,
+                                "dataIndex": "cu_taxrate",
+                                "width": 100
+                            }, {
+                                "text": "承付天数",
+                                "flex": 1,
+                                "dataIndex": "cu_promisedays",
+                                "width": 100
+                            }, {
+                                "text": "额度",
+                                "flex": 1,
+                                "dataIndex": "cu_credit",
+                                "width": 100
+                            }, {
+                                "text": "客户地址",
+                                "flex": 1,
+                                "dataIndex": "ca_address",
+                                "width": 250
+                            }]
                     }) ;   
 
                 }

+ 6 - 1
frontend/saas-web/app/view/sale/saleIn/FormPanel.js

@@ -239,8 +239,13 @@ Ext.define('saas.view.sale.saleIn.FormPanel', {
     }, {
         xtype : "textfield", 
         name : "pi_total", 
-        fieldLabel : "额", 
+        fieldLabel : "单据金额", 
         readOnly: true
+    }, {
+        xtype : "textfield", 
+        name : "pi_remark", 
+        fieldLabel : "备注", 
+        columnWidth : 0.75
     }, {
         xtype : "textfield", 
         name : "pi_recordman", 

+ 15 - 3
frontend/saas-web/app/view/sale/saleIn/FormPanelController.js

@@ -14,7 +14,7 @@ Ext.define('saas.view.sale.saleIn.FormPanelController', {
                         defaultCondition:"cu_statuscode='OPEN'",
                         dbfinds:[
                             {
-                                from:'id',to:'pi_custid'
+                                from:'id',to:'pi_custid',ignore:true
                             },{
                                 from:'cu_code',to:'pi_custcode'
                             },{
@@ -112,7 +112,7 @@ Ext.define('saas.view.sale.saleIn.FormPanelController', {
                         addTitle: '物料资料',
                         dbfinds:[
                         {
-                            from:'id',to:'pd_prodid'
+                            from:'id',to:'pd_prodid',ignore:true
                         },
                         {
                             from:'pr_code',to:'pd_prodcode'
@@ -210,7 +210,7 @@ Ext.define('saas.view.sale.saleIn.FormPanelController', {
                         addXtype: 'other-storeinformation',
                         addTitle: '仓库资料',
                         dbfinds:[{
-                            from:'id',to:'pd_whid',
+                            from:'id',to:'pd_whid',ignore:true
                         }, { 
                             from:'wh_code',to:'pd_whcode'
                         }, {
@@ -221,6 +221,18 @@ Ext.define('saas.view.sale.saleIn.FormPanelController', {
                         },{
                             field:'wh_description',width:100
                         }],
+                        defaultCondition: "wh_statuscode='OPEN'",
+                        dbSearchFields:[{
+                            emptyText:'输入物料编号、名称或规格',
+                            xtype : "textfield", 
+                            name : "search", 
+                            width: 200,
+                            getCondition: function(v) {
+                                return "(upper(wh_code) like '%" + v.toUpperCase()+"%' or upper(wh_description) like '%"+v.toUpperCase()+"%')";
+                            },
+                            allowBlank : true, 
+                            columnWidth : 0.25
+                        }],
                         dbColumns:[{
                             "text": "仓库ID",
                             "flex": 0,

+ 19 - 7
frontend/saas-web/app/view/sale/saleIn/QueryPanel.js

@@ -81,7 +81,7 @@ Ext.define('saas.view.sale.saleIn.QueryPanel', {
             dataIndex: 'pi_inoutno',
             width: 200
         }, {
-            text: '单据状态',
+            text: '审核状态',
             dataIndex: 'pi_status',
             width: 120
         }, {
@@ -97,10 +97,14 @@ Ext.define('saas.view.sale.saleIn.QueryPanel', {
             text: '销售单号',
             dataIndex: 'pi_pucode',
             width: 200
-        },{
-            text: '客户名称',
-            dataIndex: 'pi_custname',
-            width: 120
+        }, {
+            xtype: 'hidden',
+            name: 'pi_custcode',
+            fieldLabel: '客户编号'
+        }, {
+            xtype: 'dbfindtrigger',
+            name: 'pi_custname',
+            fieldLabel: '客户名称'
         },{
             text: '含税金额',
             dataIndex: 'pi_total',
@@ -110,7 +114,11 @@ Ext.define('saas.view.sale.saleIn.QueryPanel', {
             text: '未税金额',
             dataIndex: 'pi_nettotal',
             xtype:'numbercolumn',
-            width: 120,
+            width: 120
+        }, {
+            text: '备注',
+            dataIndex: 'pi_remark',
+            width: 250
         }],
         relativeColumn: [{
             text: 'id',
@@ -171,7 +179,11 @@ Ext.define('saas.view.sale.saleIn.QueryPanel', {
             text: '成本单价',
             dataIndex: 'pd_price',
             xtype:'numbercolumn',
-            width: 120,
+            width: 120
+        }, {
+            text: '备注',
+            dataIndex: 'pd_remark',
+            width: 250
         }]
     }
 });

+ 70 - 39
frontend/saas-web/app/view/sale/saleIn/QueryPanelController.js

@@ -11,53 +11,84 @@ Ext.define('saas.view.sale.saleIn.QueryPanelController', {
                         dataUrl:'/api/document/customer/dbfind',
                         addXtype: 'document-customer-formpanel',
                         addTitle: '客户资料',
+                        defaultCondition:"cu_statuscode='OPEN'",
                         dbfinds:[
                         {
-                            from:'id',to:'pi_custid'
+                            from:'id',to:'pi_custid',ignore:true
                         },{
                             from:'cu_code',to:'pi_custcode'
                         },{
                             from:'cu_name',to:'pi_custname'
                         }],
-                        dbtpls:[
-                        {
-                            field:'cu_code',width:100
-                        },{
-                            field:'cu_name',width:100
+                        dbSearchFields:[{
+                            emptyText:'输入客户编号或客户名称',
+                            xtype : "textfield", 
+                            name : "search", 
+                            getCondition: function(v) {
+                                return "(upper(cu_code) like '%"+v.toUpperCase()+"%' or upper(cu_name) like '%"+v.toUpperCase()+"%')";
+                            },
+                            allowBlank : true, 
+                            columnWidth : 0.25
                         }],
                         dbColumns:[
-                        {
-                            conditionCode:'id',
-                            "text": "客户ID",
-                            "flex": 0,
-                            "dataIndex": "id",
-                            "width": 100,
-                            "xtype": "",
-                            "items": null
-                        },{
-                            conditionCode:'cu_code',
-                            "text": "客户编号",
-                            "flex": 1,
-                            "dataIndex": "cu_code",
-                            "width": 100,
-                            "xtype": "",
-                            "items": null
-                        }, {
-                            conditionCode:'cu_name',
-                            "text": "客户名称",
-                            "flex": 1,
-                            "dataIndex": "cu_name",
-                            "xtype": "",
-                            "items": null
-                        }, {
-                            conditionCode:'cu_type',
-                            "text": "客户类型",
-                            "flex": 0,
-                            "dataIndex": "cu_type",
-                            "width": 200,
-                            "xtype": "",
-                            "items": null
-                        }]
+                            {
+                                "text": "客户ID",
+                                "flex": 0,
+                                "dataIndex": "id",
+                                "width": 0,
+                                "xtype": "",
+                                "items": null
+                            },{
+                                "text": "客户编号",
+                                "flex": 1,
+                                "dataIndex": "cu_code",
+                                "width": 100,
+                                "xtype": "",
+                                "items": null
+                            }, {
+                                "text": "客户名称",
+                                "flex": 1,
+                                "dataIndex": "cu_name",
+                                "xtype": "",
+                                "items": null
+                            }, {
+                                "text": "客户类型",
+                                "flex": 1,
+                                "dataIndex": "cu_type",
+                                "width": 200,
+                                "xtype": "",
+                                "items": null
+                            }, {
+                                "text": "业务员编号",
+                                "flex": 1,
+                                "dataIndex": "cu_sellercode",
+                                "width": 100
+                            }, {
+                                "text": "业务员",
+                                "flex": 1,
+                                "dataIndex": "cu_sellername",
+                                "width": 100
+                            }, {
+                                "text": "税率",
+                                "flex": 1,
+                                "dataIndex": "cu_taxrate",
+                                "width": 100
+                            }, {
+                                "text": "承付天数",
+                                "flex": 1,
+                                "dataIndex": "cu_promisedays",
+                                "width": 100
+                            }, {
+                                "text": "额度",
+                                "flex": 1,
+                                "dataIndex": "cu_credit",
+                                "width": 100
+                            }, {
+                                "text": "客户地址",
+                                "flex": 1,
+                                "dataIndex": "ca_address",
+                                "width": 250
+                            }]
                     }) ;   
 
                 }
@@ -71,7 +102,7 @@ Ext.define('saas.view.sale.saleIn.QueryPanelController', {
                         addXtype: 'document-product-formpanel',
                         addTitle: '物料资料',
                         dbfinds:[{
-                            from:'pr_code',to:'pd_prodcode'
+                            from:'pr_code',to:'pd_prodcode',ignore:true
                         }, {
                             from:'pr_detail',to:'pr_detail'
                         }],

+ 6 - 1
frontend/saas-web/app/view/sale/saleOut/FormPanel.js

@@ -244,8 +244,13 @@ Ext.define('saas.view.sale.saleout.FormPanel', {
     }, {
         xtype : "textfield", 
         name : "pi_total", 
-        fieldLabel : "额", 
+        fieldLabel : "单据金额", 
         readOnly: true
+    }, {
+        xtype : "textfield", 
+        name : "pi_remark", 
+        fieldLabel : "备注", 
+        columnWidth : 0.75
     }, {
         xtype : "textfield", 
         name : "pi_recordman", 

+ 16 - 5
frontend/saas-web/app/view/sale/saleOut/FormPanelController.js

@@ -15,7 +15,7 @@ Ext.define('saas.view.sale.saleout.FormPanelController', {
                         defaultCondition:"cu_statuscode='OPEN'",
                         dbfinds:[
                         {
-                            from:'id',to:'pi_custid'
+                            from:'id',to:'pi_custid',ignore:true 
                         },{
                             from:'cu_code',to:'pi_custcode'
                         },{
@@ -108,9 +108,8 @@ Ext.define('saas.view.sale.saleout.FormPanelController', {
                         dataUrl:'/api/document/product/list',
                         addXtype: 'document-product-formpanel',
                         addTitle: '物料资料',
-                        dbfinds:[
-                        {
-                            from:'id',to:'pd_prodid'
+                        dbfinds:[{
+                            from:'id',to:'pd_prodid',ignore:true 
                         },
                         {
                             from:'pr_code',to:'pd_prodcode'
@@ -209,7 +208,7 @@ Ext.define('saas.view.sale.saleout.FormPanelController', {
                         addXtype: 'other-storeinformation',
                         addTitle: '仓库资料',
                         dbfinds:[{
-                            from:'id',to:'pd_whid',
+                            from:'id',to:'pd_whid',ignore:true 
                         }, { 
                             from:'wh_code',to:'pd_whcode'
                         }, {
@@ -220,6 +219,18 @@ Ext.define('saas.view.sale.saleout.FormPanelController', {
                         },{
                             field:'wh_description',width:100
                         }],
+                        defaultCondition: "wh_statuscode='OPEN'",
+                        dbSearchFields:[{
+                            emptyText:'输入物料编号、名称或规格',
+                            xtype : "textfield", 
+                            name : "search", 
+                            width: 200,
+                            getCondition: function(v) {
+                                return "(upper(wh_code) like '%" + v.toUpperCase()+"%' or upper(wh_description) like '%"+v.toUpperCase()+"%')";
+                            },
+                            allowBlank : true, 
+                            columnWidth : 0.25
+                        }],
                         dbColumns:[{
                             "text": "仓库ID",
                             "flex": 0,

+ 15 - 6
frontend/saas-web/app/view/sale/saleOut/QueryPanel.js

@@ -31,12 +31,12 @@ Ext.define('saas.view.sale.saleout.QueryPanel', {
         name: 'pi_custname',
         fieldLabel: '客户名称'
     }, {
-        xtype: 'hidden',
+        xtype: 'dbfindtrigger',
         name: 'pd_prodcode',
         fieldLabel: '物料编号',
         showDetail: true
     }, {
-        xtype: 'dbfindtrigger',
+        xtype: 'textfield',
         name: 'pr_detail',
         fieldLabel: '物料名称',
         showDetail: true
@@ -81,7 +81,7 @@ Ext.define('saas.view.sale.saleout.QueryPanel', {
             dataIndex: 'pi_inoutno',
             width: 200
         }, {
-            text: '单据状态',
+            text: '审核状态',
             dataIndex: 'pi_status',
             width: 120
         },{
@@ -111,11 +111,16 @@ Ext.define('saas.view.sale.saleout.QueryPanel', {
             dataIndex: 'pi_nettotal',
             xtype:'numbercolumn',
             width: 120
+        }, {
+            text: '备注',
+            dataIndex: 'pi_remark',
+            width: 250,
+            flex:1
         }],
         relativeColumn: [{
             text: 'id',
-            dataIndex: 'pi_id',
-            width: 100,
+            dataIndex: 'id',
+            width: 0,
             xtype: 'numbercolumn'
         }, {
             text: '单据编号',
@@ -176,7 +181,11 @@ Ext.define('saas.view.sale.saleout.QueryPanel', {
             text: '成本单价',
             dataIndex: 'pd_price',
             xtype:'numbercolumn',
-            width: 120,
+            width: 120
+        }, {
+            text: '备注',
+            dataIndex: 'pd_remark',
+            width: 250
         }]
     }
 });

+ 14 - 7
frontend/saas-web/app/view/sale/saleOut/QueryPanelController.js

@@ -12,15 +12,16 @@ Ext.define('saas.view.sale.saleout.QueryPanelController', {
                         dataUrl:'/api/document/customer/dbfind',
                         addXtype: 'document-customer-formpanel',
                         addTitle: '客户资料',
+                        defaultCondition:"cu_statuscode='OPEN'",
                         dbfinds:[
                         {
-                            from:'id',to:'pi_custid'
+                            from:'id',to:'pi_custid',ignore:true
                         },{
                             from:'cu_code',to:'pi_custcode'
                         },{
                             from:'cu_name',to:'pi_custname'
                         },{
-                            from:'ca_address',to:'pi_address'
+                            from:'ca_address',to:'ca_address'
                         }],
                         dbtpls:[
                         {
@@ -28,9 +29,18 @@ Ext.define('saas.view.sale.saleout.QueryPanelController', {
                         },{
                             field:'cu_name',width:100
                         }],
+                        dbSearchFields:[{
+                            emptyText:'输入客户编号或客户名称',
+                            xtype : "textfield", 
+                            name : "search", 
+                            getCondition: function(v) {
+                                return "(upper(cu_code) like '%"+v.toUpperCase()+"%' or upper(cu_name) like '%"+v.toUpperCase()+"%')";
+                            },
+                            allowBlank : true, 
+                            columnWidth : 0.25
+                        }],
                         dbColumns:[
                             {
-                                conditionCode:'id',
                                 "text": "客户ID",
                                 "flex": 0,
                                 "dataIndex": "id",
@@ -38,7 +48,6 @@ Ext.define('saas.view.sale.saleout.QueryPanelController', {
                                 "xtype": "",
                                 "items": null
                             },{
-                                conditionCode:'cu_code',
                                 "text": "客户编号",
                                 "flex": 1,
                                 "dataIndex": "cu_code",
@@ -46,14 +55,12 @@ Ext.define('saas.view.sale.saleout.QueryPanelController', {
                                 "xtype": "",
                                 "items": null
                             }, {
-                                conditionCode:'cu_name',
                                 "text": "客户名称",
                                 "flex": 1,
                                 "dataIndex": "cu_name",
                                 "xtype": "",
                                 "items": null
                             }, {
-                                conditionCode:'cu_type',
                                 "text": "客户类型",
                                 "flex": 1,
                                 "dataIndex": "cu_type",
@@ -95,10 +102,10 @@ Ext.define('saas.view.sale.saleout.QueryPanelController', {
 
                 }
             },
+            // 物料编号
             'dbfindtrigger[name=pd_prodcode]':{
                 beforerender:function(f){
                     Ext.apply(f,{
-                        conditionCode:'pr_code',
                         dataUrl:'/api/document/product/list',
                         addXtype: 'document-product-formpanel',
                         addTitle: '物料资料',