Browse Source

Merge branch 'master' of http://git.iamberry.com/hexiugang/iamberry-common-parent

wangxiaoming 6 years ago
parent
commit
4d39c757fe
30 changed files with 1426 additions and 172 deletions
  1. 51 7
      watero-common-tool/src/main/java/com/iamberry/redis/RedisUtils.java
  2. 76 1
      watero-rst-core/src/main/java/com.iamberry.rst.core/fm/ComplaintDetectInfo.java
  3. 117 0
      watero-rst-core/src/main/java/com.iamberry.rst.core/fm/InventoryInfo.java
  4. 9 0
      watero-rst-core/src/main/java/com.iamberry.rst.core/fm/InventoryLog.java
  5. 6 0
      watero-rst-interface/src/main/java/com/iamberry/rst/faces/cm/InventoryService.java
  6. 6 0
      watero-rst-interface/src/main/java/com/iamberry/rst/faces/fm/ComplaintDetectInfoService.java
  7. 5 0
      watero-rst-service/src/main/java/com/iamberry/rst/service/cm/InventoryServiceImpl.java
  8. 46 0
      watero-rst-service/src/main/java/com/iamberry/rst/service/cm/SalesOrderServiceImpl.java
  9. 8 3
      watero-rst-service/src/main/java/com/iamberry/rst/service/fm/ComplaintDetectInfoServiceImpl.java
  10. 62 19
      watero-rst-service/src/main/java/com/iamberry/rst/service/fm/ComplaintSignclosedInfoServiceImpl.java
  11. 6 0
      watero-rst-service/src/main/java/com/iamberry/rst/service/fm/mapper/ComplaintDetectInfoMapper.java
  12. 6 0
      watero-rst-service/src/main/java/com/iamberry/rst/service/fm/mapper/InventoryMapper.java
  13. 71 3
      watero-rst-service/src/main/java/com/iamberry/rst/service/fm/mapper/complaintDetectInfoMapper.xml
  14. 11 3
      watero-rst-service/src/main/java/com/iamberry/rst/service/fm/mapper/inventoryLogMapper.xml
  15. 142 16
      watero-rst-service/src/main/java/com/iamberry/rst/service/fm/mapper/inventoryMapper.xml
  16. 45 0
      watero-rst-service/src/main/java/com/iamberry/rst/util/ProduceNoUtil.java
  17. 49 3
      watero-rst-web/src/main/java/com/iamberry/rst/controllers/cm/AdminDetectController.java
  18. 93 42
      watero-rst-web/src/main/java/com/iamberry/rst/controllers/order/AwaitSendController.java
  19. 97 19
      watero-rst-web/src/main/java/com/iamberry/rst/controllers/pts/InventoryController.java
  20. 44 0
      watero-rst-web/src/main/java/com/iamberry/rst/utils/GenerateKeyUtil.java
  21. 7 1
      watero-rst-web/src/main/resources/platform.properties
  22. 1 1
      watero-rst-web/src/main/webapp/WEB-INF/views/cm/customer/add_customer.ftl
  23. 3 0
      watero-rst-web/src/main/webapp/WEB-INF/views/cm/customer/update_relation.ftl
  24. 92 0
      watero-rst-web/src/main/webapp/WEB-INF/views/cm/inspection/add_QC.ftl
  25. 87 0
      watero-rst-web/src/main/webapp/WEB-INF/views/cm/inspection/add_content.ftl
  26. 11 7
      watero-rst-web/src/main/webapp/WEB-INF/views/cm/inspection/detect_list.ftl
  27. 60 3
      watero-rst-web/src/main/webapp/WEB-INF/views/cm/inspection/update_complete.ftl
  28. 22 10
      watero-rst-web/src/main/webapp/WEB-INF/views/cm/inventory/inventoryLog_list.ftl
  29. 50 34
      watero-rst-web/src/main/webapp/WEB-INF/views/cm/inventory/inventory_list.ftl
  30. 143 0
      watero-rst-web/src/main/webapp/WEB-INF/views/cm/inventory/update_inventory.ftl

+ 51 - 7
watero-common-tool/src/main/java/com/iamberry/redis/RedisUtils.java

@@ -2,11 +2,13 @@ package com.iamberry.redis;
 
 import com.alibaba.fastjson.JSONObject;
 import com.iamberry.wechat.tools.NameUtils;
+import com.iamberry.wechat.tools.payUtil.DatetimeUtil;
 import org.apache.log4j.Logger;
 import redis.clients.jedis.Jedis;
 import redis.clients.jedis.JedisPool;
 import redis.clients.jedis.JedisPoolConfig;
 
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -81,7 +83,7 @@ public class RedisUtils {
         } catch (Exception e) {
             logger.error("", e);
         } finally {
-            getColse(jedis);
+            colse(jedis);
         }
         return false;
     }
@@ -100,7 +102,7 @@ public class RedisUtils {
         } catch (Exception e) {
             logger.error("", e);
         } finally {
-            getColse(jedis);
+            colse(jedis);
         }
         return false;
     }
@@ -120,7 +122,7 @@ public class RedisUtils {
         } catch (Exception e) {
             logger.error("", e);
         } finally {
-            getColse(jedis);
+            colse(jedis);
         }
         return null;
     }
@@ -138,7 +140,7 @@ public class RedisUtils {
         } catch (Exception e) {
             logger.error("", e);
         } finally {
-            getColse(jedis);
+            colse(jedis);
         }
         return null;
     }
@@ -158,7 +160,7 @@ public class RedisUtils {
         } catch (Exception e) {
             logger.error("", e);
         } finally {
-            getColse(jedis);
+            colse(jedis);
         }
         return null;
     }
@@ -176,18 +178,60 @@ public class RedisUtils {
         } catch (Exception e) {
             logger.error("", e);
         } finally {
-            getColse(jedis);
+            colse(jedis);
         }
         return false;
     }
 
+
+    /**
+     * 设置过期时间
+     * @param key
+     * @param date
+     */
+    public static void expire(String key, Date date) {
+        Jedis jedis = null;
+        try {
+            jedis = getJedis();
+
+            if (null != date) {
+                long nowTime = System.currentTimeMillis();
+                long dateTime = date.getTime();
+                if (dateTime > nowTime) {
+                    jedis.expire(key, (int)(dateTime - nowTime) / 1000);
+                }
+            }
+        }catch (Exception e){
+            logger.error("", e);
+        }finally {
+            colse(jedis);
+        }
+    }
+
     /**
      * 关闭连接
      * @param jedis
      */
-    private static void getColse(Jedis jedis) {
+    private static void colse(Jedis jedis) {
         if(jedis != null) {
             jedis.close();
         }
     }
+
+    public static void main(String[] args) {
+        // 判断Redis是否存在当前月的缓存信息
+        String key = "weixiu_total_" + "201905";
+        String total = get(key);
+        String no = null;
+        if (total == null) {
+            // 本月没有生成过数据
+            no = "0001";
+            // 写入下次的使用数据
+            put(key, "0002");
+            // 设置31天后过期
+            expire(key, new Date(System.currentTimeMillis() + 2678400000L));
+        } else {
+            no = total;
+        }
+    }
 }

+ 76 - 1
watero-rst-core/src/main/java/com.iamberry.rst.core/fm/ComplaintDetectInfo.java

@@ -26,7 +26,7 @@ public class ComplaintDetectInfo implements Serializable {
     private String detectResults;//判定结果
     private String detectPoint;//故障指向
     private String detectNalysis;//原因分析
-    private String detectContent;//维修内容
+    private String detectContent;//维修内容(维修记录)
     private Integer isMaintenance;//是否有故障1 有故障 2没有
     private String detectDesc;//备注
     @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@@ -64,6 +64,17 @@ public class ComplaintDetectInfo implements Serializable {
 
     private Date maintenanceCutTime;//待维修截止时间
 
+    //5月8号新增字段
+    private String detectProduction;//生产月份
+    private String detectFuselageBarcode;//机身条码
+    private Integer detectFilmType;//厚膜类型1圆、2扁
+    private Integer detectFloatType;//浮子类型1长、2短
+    private String detectVersionNumber;//版本号
+    private Integer detectIsRefurbishing;//是否翻新机1是 2否
+    private Integer maintenanceResults;//QC检测结果1.通过 2不通过
+    private String detectNumber;//维修编号
+
+
     public Integer getDetectId() {
         return detectId;
     }
@@ -359,4 +370,68 @@ public class ComplaintDetectInfo implements Serializable {
     public void setMaintenanceCutTime(Date maintenanceCutTime) {
         this.maintenanceCutTime = maintenanceCutTime;
     }
+
+    public String getDetectProduction() {
+        return detectProduction;
+    }
+
+    public void setDetectProduction(String detectProduction) {
+        this.detectProduction = detectProduction;
+    }
+
+    public String getDetectFuselageBarcode() {
+        return detectFuselageBarcode;
+    }
+
+    public void setDetectFuselageBarcode(String detectFuselageBarcode) {
+        this.detectFuselageBarcode = detectFuselageBarcode;
+    }
+
+    public Integer getDetectFilmType() {
+        return detectFilmType;
+    }
+
+    public void setDetectFilmType(Integer detectFilmType) {
+        this.detectFilmType = detectFilmType;
+    }
+
+    public Integer getDetectFloatType() {
+        return detectFloatType;
+    }
+
+    public void setDetectFloatType(Integer detectFloatType) {
+        this.detectFloatType = detectFloatType;
+    }
+
+    public String getDetectVersionNumber() {
+        return detectVersionNumber;
+    }
+
+    public void setDetectVersionNumber(String detectVersionNumber) {
+        this.detectVersionNumber = detectVersionNumber;
+    }
+
+    public Integer getDetectIsRefurbishing() {
+        return detectIsRefurbishing;
+    }
+
+    public void setDetectIsRefurbishing(Integer detectIsRefurbishing) {
+        this.detectIsRefurbishing = detectIsRefurbishing;
+    }
+
+    public Integer getMaintenanceResults() {
+        return maintenanceResults;
+    }
+
+    public void setMaintenanceResults(Integer maintenanceResults) {
+        this.maintenanceResults = maintenanceResults;
+    }
+
+    public String getDetectNumber() {
+        return detectNumber;
+    }
+
+    public void setDetectNumber(String detectNumber) {
+        this.detectNumber = detectNumber;
+    }
 }

+ 117 - 0
watero-rst-core/src/main/java/com.iamberry.rst.core/fm/InventoryInfo.java

@@ -17,6 +17,19 @@ public class InventoryInfo implements Serializable{
     private String inventoryDesc;//备注
     private Date inventoryCreateTime;//创建时间
     private Date inventoryUpdateTime;//修改时间
+    private Integer inventoryProductColorId;//产品颜色id
+    private Integer inventoryGoodProductNum;//良品数量
+    private Integer inventoryDefectiveProductNum;//不良品数量
+    private String inventoryRecentRecord;//最近记录
+    private String productTypeName;//产品类型
+    private String productNumber;//产品型号
+    private String productAbbreviation;//产品简称
+    private String productColorName;//颜色名称
+    private Integer inventoryMomentumNum;//待发数量
+    private Integer operationType;//操作类型 1出库 2 入库
+    private Integer qualityType;//产品质量类型 1良品 2 不良品
+    private Integer operationNum;//操作数量
+    private Integer productTypeId;//产品类型id
 
     public Integer getInventoryId() {
         return inventoryId;
@@ -81,4 +94,108 @@ public class InventoryInfo implements Serializable{
     public void setInventoryUpdateTime(Date inventoryUpdateTime) {
         this.inventoryUpdateTime = inventoryUpdateTime;
     }
+
+    public Integer getInventoryProductColorId() {
+        return inventoryProductColorId;
+    }
+
+    public void setInventoryProductColorId(Integer inventoryProductColorId) {
+        this.inventoryProductColorId = inventoryProductColorId;
+    }
+
+    public Integer getInventoryGoodProductNum() {
+        return inventoryGoodProductNum;
+    }
+
+    public void setInventoryGoodProductNum(Integer inventoryGoodProductNum) {
+        this.inventoryGoodProductNum = inventoryGoodProductNum;
+    }
+
+    public Integer getInventoryDefectiveProductNum() {
+        return inventoryDefectiveProductNum;
+    }
+
+    public void setInventoryDefectiveProductNum(Integer inventoryDefectiveProductNum) {
+        this.inventoryDefectiveProductNum = inventoryDefectiveProductNum;
+    }
+
+    public String getInventoryRecentRecord() {
+        return inventoryRecentRecord;
+    }
+
+    public void setInventoryRecentRecord(String inventoryRecentRecord) {
+        this.inventoryRecentRecord = inventoryRecentRecord;
+    }
+
+    public String getProductTypeName() {
+        return productTypeName;
+    }
+
+    public void setProductTypeName(String productTypeName) {
+        this.productTypeName = productTypeName;
+    }
+
+    public String getProductNumber() {
+        return productNumber;
+    }
+
+    public void setProductNumber(String productNumber) {
+        this.productNumber = productNumber;
+    }
+
+    public String getProductAbbreviation() {
+        return productAbbreviation;
+    }
+
+    public void setProductAbbreviation(String productAbbreviation) {
+        this.productAbbreviation = productAbbreviation;
+    }
+
+    public String getProductColorName() {
+        return productColorName;
+    }
+
+    public void setProductColorName(String productColorName) {
+        this.productColorName = productColorName;
+    }
+
+    public Integer getInventoryMomentumNum() {
+        return inventoryMomentumNum;
+    }
+
+    public void setInventoryMomentumNum(Integer inventoryMomentumNum) {
+        this.inventoryMomentumNum = inventoryMomentumNum;
+    }
+
+    public Integer getOperationType() {
+        return operationType;
+    }
+
+    public void setOperationType(Integer operationType) {
+        this.operationType = operationType;
+    }
+
+    public Integer getQualityType() {
+        return qualityType;
+    }
+
+    public void setQualityType(Integer qualityType) {
+        this.qualityType = qualityType;
+    }
+
+    public Integer getOperationNum() {
+        return operationNum;
+    }
+
+    public void setOperationNum(Integer operationNum) {
+        this.operationNum = operationNum;
+    }
+
+    public Integer getProductTypeId() {
+        return productTypeId;
+    }
+
+    public void setProductTypeId(Integer productTypeId) {
+        this.productTypeId = productTypeId;
+    }
 }

+ 9 - 0
watero-rst-core/src/main/java/com.iamberry.rst.core/fm/InventoryLog.java

@@ -19,6 +19,7 @@ public class InventoryLog implements Serializable {
     private String logDesc;//备注
     private Date logCreateTime;//创建时间
     private Date logUpdateTime;//修改时间
+    private Integer logQualityType;//1.良品 2不良品
 
     private String logWarehouseName;//仓库名称
 
@@ -109,4 +110,12 @@ public class InventoryLog implements Serializable {
     public void setLogWarehouseName(String logWarehouseName) {
         this.logWarehouseName = logWarehouseName;
     }
+
+    public Integer getLogQualityType() {
+        return logQualityType;
+    }
+
+    public void setLogQualityType(Integer logQualityType) {
+        this.logQualityType = logQualityType;
+    }
 }

+ 6 - 0
watero-rst-interface/src/main/java/com/iamberry/rst/faces/cm/InventoryService.java

@@ -21,4 +21,10 @@ public interface InventoryService {
      * 获取库存信息列表
      */
     Integer updateById(InventoryInfo inventoryInfo);
+    /**
+     * 根据69码获取单个库存信息
+     * @param inventoryProductBar
+     * @return
+     */
+    InventoryInfo getByInventoryByBar(String inventoryProductBar);
 }

+ 6 - 0
watero-rst-interface/src/main/java/com/iamberry/rst/faces/fm/ComplaintDetectInfoService.java

@@ -76,4 +76,10 @@ public interface ComplaintDetectInfoService {
      * @return
      */
     List<ComplaintDetectImg> listDetectImg(Integer detectId);
+
+    /**
+     * 查询当前月份维修数量
+     * @return
+     */
+    Integer getDetectNum();
 }

+ 5 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/cm/InventoryServiceImpl.java

@@ -38,4 +38,9 @@ public class InventoryServiceImpl implements InventoryService {
     public Integer updateById(InventoryInfo inventoryInfo) {
         return inventoryMapper.updateById(inventoryInfo);
     }
+
+    @Override
+    public InventoryInfo getByInventoryByBar(String inventoryProductBar) {
+        return inventoryMapper.getByInventoryByBar(inventoryProductBar);
+    }
 }

+ 46 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/cm/SalesOrderServiceImpl.java

@@ -6,6 +6,8 @@ import com.iamberry.rst.core.cm.FittingsInfo;
 import com.iamberry.rst.core.cm.SalesOrder;
 import com.iamberry.rst.core.cm.SalesOrderItem;
 import com.iamberry.rst.core.cm.StoreInfo;
+import com.iamberry.rst.core.fm.InventoryInfo;
+import com.iamberry.rst.core.fm.InventoryLog;
 import com.iamberry.rst.core.order.*;
 import com.iamberry.rst.core.page.PagedResult;
 import com.iamberry.rst.core.sys.Admin;
@@ -18,6 +20,8 @@ import com.iamberry.rst.faces.order.EfastOrderService;
 import com.iamberry.rst.faces.product.ProductService;
 import com.iamberry.rst.service.cm.mapper.FittingsInfoMapper;
 import com.iamberry.rst.service.cm.mapper.SalesOrderMapper;
+import com.iamberry.rst.service.fm.mapper.InventoryLogMapper;
+import com.iamberry.rst.service.fm.mapper.InventoryMapper;
 import com.iamberry.rst.service.order.mapper.LogisticsInfoMapper;
 import com.iamberry.rst.service.order.mapper.ProvincesLogisticsMapper;
 import com.iamberry.rst.service.product.mapper.ProductMapper;
@@ -34,6 +38,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.beans.Transient;
+import java.text.SimpleDateFormat;
 import java.util.*;
 
 /**
@@ -64,6 +69,10 @@ public class SalesOrderServiceImpl implements SalesOrderService {
     private ProvincesLogisticsMapper provincesLogisticsMapper;
     @Autowired
     private ProductMapper productMapper;
+    @Autowired
+    private InventoryMapper inventoryMapper;
+    @Autowired
+    private InventoryLogMapper inventoryLogMapper;
 
 
     @Override
@@ -1016,10 +1025,47 @@ public class SalesOrderServiceImpl implements SalesOrderService {
         return salesOrderMapper.getSalesOrderByPostNum(postNum);
     }
 
+    @Transactional
     @Override
     public Integer updateDeliver(SalesOrder salesOrder) {
+            if(salesOrder.getSalesDeliver() == 2){//修改库存
+                if(!updateInventory(salesOrder.getSalesId())){
+                    throw  new RuntimeException("标记出库-修改库存失败!");
+                }
+            }
         return salesOrderMapper.updateDeliver(salesOrder);
     }
+    public boolean updateInventory(Integer salesId){
+        SalesOrderItem salesOrderItem = new SalesOrderItem();
+        salesOrderItem.setItemOrderId(salesId);
+        List<SalesOrderItem> listOrderitem = salesOrderService.listSalesOrderItem(salesOrderItem);
+        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        for(SalesOrderItem item : listOrderitem){
+            InventoryInfo info = inventoryMapper.getByInventoryByBar(item.getItemColorBar());
+            if(info != null){
+                if(info.getInventoryGoodProductNum() >= item.getItemNum()){
+                    info.setInventoryGoodProductNum(info.getInventoryGoodProductNum() - item.getItemNum());
+                    info.setInventoryRecentRecord(sdf.format(new Date())+"出库:"+item.getItemNum()+"件");
+                    inventoryMapper.updateById(info);
+                    //添加日志
+                    InventoryLog inventoryLog = new InventoryLog();
+                    inventoryLog.setLogProductName(info.getInventoryProductName());
+                    inventoryLog.setLogProductBar(info.getInventoryProductBar());
+                    inventoryLog.setLogRemainingNum(item.getItemNum());
+                    inventoryLog.setLogType(2);
+                    inventoryLog.setLogOperationType(2);
+                    inventoryLog.setLogDesc(sdf.format(new Date())+"待发货标记出库:"+item.getItemNum()+"件");
+                    inventoryLog.setLogQualityType(1);
+                    inventoryLog.setLogWarehouseId(1);
+                    inventoryLogMapper.insert(inventoryLog);
+                }else{
+                    return false;
+                }
+            }
+
+        }
+        return true;
+    }
 
     @Override
     public List<SalesOrderItem> getDeliverNum(SalesOrder salesOrder) {

+ 8 - 3
watero-rst-service/src/main/java/com/iamberry/rst/service/fm/ComplaintDetectInfoServiceImpl.java

@@ -79,7 +79,7 @@ public class ComplaintDetectInfoServiceImpl implements ComplaintDetectInfoServic
             }
         }
 
-        try {
+      /*  try {*/
             if(complaintDetectInfoMapper.updateDetectById(record) > 0){
                 if(imgs != null){
                     if(imgs.length > 0){
@@ -92,9 +92,9 @@ public class ComplaintDetectInfoServiceImpl implements ComplaintDetectInfoServic
                     }
                 }
             }
-        }catch (Exception e){
+       /* }catch (Exception e){
             throw new RuntimeException("完成检测失败");
-        }
+        }*/
         return 1;
     }
     @Override
@@ -195,5 +195,10 @@ public class ComplaintDetectInfoServiceImpl implements ComplaintDetectInfoServic
         return complaintDetectInfoMapper.listDetectImg(detectId);
     }
 
+    @Override
+    public Integer getDetectNum() {
+        return complaintDetectInfoMapper.getDetectNum();
+    }
+
 
 }

+ 62 - 19
watero-rst-service/src/main/java/com/iamberry/rst/service/fm/ComplaintSignclosedInfoServiceImpl.java

@@ -2,6 +2,7 @@ package com.iamberry.rst.service.fm;
 
 
 import com.github.pagehelper.PageHelper;
+import com.iamberry.redis.RedisUtils;
 import com.iamberry.rst.core.cm.*;
 import com.iamberry.rst.core.fm.*;
 import com.iamberry.rst.core.order.Product;
@@ -16,11 +17,13 @@ import com.iamberry.rst.service.fm.mapper.ComplaintSignclosedInfoMapper;
 import com.iamberry.rst.service.fm.mapper.ComplaintSignclosedProductInfoMapper;
 import com.iamberry.rst.service.product.mapper.ProductMapper;
 import com.iamberry.rst.util.PageUtil;
+import com.iamberry.rst.util.ProduceNoUtil;
 import net.sf.json.JSONArray;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -233,32 +236,71 @@ public class ComplaintSignclosedInfoServiceImpl implements ComplaintSignclosedIn
             for (SignclosedProductInfo productInfo : sigInfo.getSignclosedProductInfoList()) {
                 ProductColor productColor = productMapper.getProduceColor(productInfo.getSignclosedProductColor());
                 Product product = productMapper.getProduce(productColor.getColorProductId());
-                if (product.getProductIsDetection() == 1) {
-                    for (int j = 0; j < productInfo.getProductNum(); j++) {
-                        //添加待检测信息
-                        //查询签收信息
-                        ComplaintDetectInfo detectInfo = new ComplaintDetectInfo();
-                        detectInfo.setProductId(productColor.getColorProductId());
-                        detectInfo.setProductColorId(productInfo.getSignclosedProductColor());
-                        detectInfo.setDetectProductNumber(product.getProductNumber());
-                        detectInfo.setDetectState(1);
-                        detectInfo.setCustomerId(sigInfo.getSignclosedCustomerId());
-                        detectInfo.setIsMaintenance(0);
-                        detectInfo.setDetectRenovation(0);
-                        detectInfo.setDetectProcessingResults(0);
-                        detectInfo.setSignclosedId(sigInfo.getSignclosedId());
-                        try {
-                            complaintDetectInfoMapper.insert(detectInfo);
-                        } catch (Exception e) {
-                            throw new RuntimeException("------------生成检测信息出错------------");
+                if(product.getProductIsDetection() != null){
+                    if (product.getProductIsDetection() == 1) {
+                        for (int j = 0; j < productInfo.getProductNum(); j++) {
+                            //添加待检测信息
+                            //查询签收信息
+                            ComplaintDetectInfo detectInfo = new ComplaintDetectInfo();
+                            //生成维修编号
+                            String number = detectNumber();
+                            detectInfo.setDetectNumber(number);
+                            detectInfo.setProductId(productColor.getColorProductId());
+                            detectInfo.setProductColorId(productInfo.getSignclosedProductColor());
+                            detectInfo.setDetectProductNumber(product.getProductNumber());
+                            detectInfo.setDetectState(1);
+                            detectInfo.setCustomerId(sigInfo.getSignclosedCustomerId());
+                            detectInfo.setIsMaintenance(0);
+                            detectInfo.setDetectRenovation(0);
+                            detectInfo.setDetectProcessingResults(0);
+                            detectInfo.setSignclosedId(sigInfo.getSignclosedId());
+                            try {
+                                complaintDetectInfoMapper.insert(detectInfo);
+                            } catch (Exception e) {
+                                throw new RuntimeException("------------生成检测信息出错------------");
+                            }
                         }
                     }
                 }
-
             }
         }
     }
 
+    /**
+     * 生成维修编号
+     * @return
+     */
+    public String detectNumber(){
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM");
+        String year = sdf.format(new Date());
+        String detectNum = RedisUtils.get("detect_"+year);
+        Integer detectNumber;
+        if(detectNum == null){
+            //查询当前月份所有维修机器
+            Integer num = complaintDetectInfoMapper.getDetectNum();
+            RedisUtils.put("detect_"+year,num);/*
+            RedisUtils.expire(SC_DETECT+year,new Date(System.currentTimeMillis() + 2678400000L));*/
+            detectNumber = num;
+        }else{
+            detectNumber =Integer.parseInt(detectNum)+ 1;
+            RedisUtils.put("detect_"+year,detectNumber);
+        }
+        switch (detectNumber.toString().length()){
+            case 1:
+                detectNum = "000"+detectNumber;
+                break;
+            case 2:
+                detectNum = "00"+detectNumber;
+                break;
+            case 3:
+                detectNum = "0"+detectNumber;
+                break;
+            case 4:
+                detectNum = detectNumber.toString();
+                break;
+        }
+        return year+detectNum;
+    }
     @Override
     public List<SignclosedProductInfo> listSignclosedById(Integer signclosedId) {
         return complaintSignclosedInfoMapper.listSignclosedById(signclosedId);
@@ -432,6 +474,7 @@ public class ComplaintSignclosedInfoServiceImpl implements ComplaintSignclosedIn
             sendbackInfo.setSendbackStatus(3);
             sendbackInfo.setSendbackLogisticsCompany(signclosedInfo.getSignclosedLogistics());
             sendbackInfo.setSendbackLogisticsNo(signclosedInfo.getSignclosedLogisticsNumber());
+            sendbackInfo.setSendbackSignTime(signclosedInfo.getSignclosedDate());
             customerInfoMapper.updateSendbackInfo(sendbackInfo);
         }
         //关联客诉/判断是否生成客诉信息

+ 6 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/fm/mapper/ComplaintDetectInfoMapper.java

@@ -57,4 +57,10 @@ public interface ComplaintDetectInfoMapper {
      * @return
      */
     List<ComplaintDetectImg> listDetectImg(Integer detectId);
+
+    /**
+     * 查询当前月份维修数量
+     * @return
+     */
+    Integer getDetectNum();
 }

+ 6 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/fm/mapper/InventoryMapper.java

@@ -15,6 +15,12 @@ public interface InventoryMapper {
      */
     InventoryInfo getByInventoryId(Integer inventoryId);
     /**
+     * 根据69码获取单个库存信息
+     * @param inventoryProductBar
+     * @return
+     */
+    InventoryInfo getByInventoryByBar(String inventoryProductBar);
+    /**
      * 获取库存信息列表
      */
     List<InventoryInfo> listByInventoryId(InventoryInfo inventoryInfo);

+ 71 - 3
watero-rst-service/src/main/java/com/iamberry/rst/service/fm/mapper/complaintDetectInfoMapper.xml

@@ -26,6 +26,14 @@
       detect_offer detectOffer,
       detect_renovation detectRenovation,
       detect_processing_results detectProcessingResults,
+      detect_production detectProduction,
+      detect_fuselage_barcode detectFuselageBarcode,
+      detect_film_type detectFilmType,
+      detect_float_type detectFloatType,
+      detect_version_number detectVersionNumber,
+      detect_is_refurbishing detectIsRefurbishing,
+      maintenance_results maintenanceResults,
+      detect_number detectNumber,
       cd.signclosed_id signclosedId,
       pi.product_name productName,
       ci.color_name colorName,
@@ -66,6 +74,14 @@
     cd.detect_renovation detectRenovation,
     cd.detect_processing_results detectProcessingResults,
     cd.detect_customer_desc detectCustomerDesc,
+    cd.detect_production detectProduction,
+    cd.detect_fuselage_barcode detectFuselageBarcode,
+    cd.detect_film_type detectFilmType,
+    cd.detect_float_type detectFloatType,
+    cd.detect_version_number detectVersionNumber,
+    cd.detect_is_refurbishing detectIsRefurbishing,
+    cd.maintenance_results maintenanceResults,
+    cd.detect_number detectNumber,
     qd.describe_title questionTitle,
     pi.product_name productName,
     pt.type_name productTypeName,
@@ -126,6 +142,9 @@
       <if test="detectProcessingResults != null and detectProcessingResults != ''" >
         AND cd.detect_processing_results = #{detectProcessingResults}
       </if>
+      <if test="detectNumber != null and detectNumber != ''" >
+        AND cd.detect_number = #{detectNumber}
+      </if>
     </where>
       ORDER BY cd.detect_create_time DESC
   </select>
@@ -182,7 +201,31 @@
         detect_processing_results = #{detectProcessingResults,jdbcType=TIMESTAMP},
       </if>
       <if test="detectCustomerDesc != null" >
-        detect_customer_desc = #{detectCustomerDesc,jdbcType=VARCHAR}
+        detect_customer_desc = #{detectCustomerDesc,jdbcType=VARCHAR},
+      </if>
+      <if test="detectProduction != null" >
+          detect_production = #{detectProduction,jdbcType=VARCHAR},
+      </if>
+      <if test="detectFuselageBarcode != null  and detectFuselageBarcode != ''" >
+          detect_fuselage_barcode = #{detectFuselageBarcode,jdbcType=VARCHAR},
+      </if>
+      <if test="detectFilmType != null and detectFilmType != ''" >
+          detect_film_type = #{detectFilmType,jdbcType=INTEGER},
+      </if>
+      <if test="detectFloatType != null and detectFloatType != ''" >
+          detect_float_type = #{detectFloatType,jdbcType=VARCHAR},
+      </if>
+      <if test="detectVersionNumber != null and detectVersionNumber != ''" >
+          detect_version_number = #{detectVersionNumber,jdbcType=VARCHAR},
+      </if>
+      <if test="detectIsRefurbishing != null and detectIsRefurbishing != ''" >
+          detect_is_refurbishing = #{detectIsRefurbishing,jdbcType=VARCHAR},
+      </if>
+      <if test="maintenanceResults != null and maintenanceResults != ''" >
+          maintenance_results = #{maintenanceResults,jdbcType=VARCHAR},
+      </if>
+      <if test="detectNumber != null and detectNumber != ''" >
+          detect_number = #{detectNumber,jdbcType=VARCHAR}
       </if>
     </set>
     where
@@ -212,7 +255,15 @@
     detect_offer,
     detect_renovation,
     detect_processing_results,
-    signclosed_id
+    signclosed_id,
+    detect_production,
+    detect_fuselage_barcode,
+    detect_film_type,
+    detect_float_type,
+    detect_version_number,
+    detect_is_refurbishing,
+    maintenance_results,
+    detect_number
     )
     values
       (
@@ -236,7 +287,15 @@
       #{detectOffer},
       #{detectRenovation},
       #{detectProcessingResults},
-      #{signclosedId}
+      #{signclosedId},
+      #{detectProduction},
+      #{detectFuselageBarcode},
+      #{detectFilmType},
+      #{detectFloatType},
+      #{detectVersionNumber},
+      #{detectIsRefurbishing},
+      #{maintenanceResults},
+      #{detectNumber}
       )
   </insert>
 
@@ -267,4 +326,13 @@
     select * from tb_rst_complaint_detect_img
     where detect_id = #{detectId}
   </select>
+
+  <select id="getDetectNum" resultType="Integer">
+    SELECT
+        count(1)
+    FROM
+        tb_rst_complaint_detect
+    WHERE
+        date_format(detect_create_time, '%Y-%m') = date_format(now(), '%Y-%m')
+  </select>
 </mapper>

+ 11 - 3
watero-rst-service/src/main/java/com/iamberry/rst/service/fm/mapper/inventoryLogMapper.xml

@@ -12,6 +12,7 @@
     <result column="log_desc" property="logDesc" jdbcType="VARCHAR" />
     <result column="log_create_time" property="logCreateTime" jdbcType="TIMESTAMP" />
     <result column="log_update_time" property="logUpdateTime" jdbcType="TIMESTAMP" />
+    <result column="log_quality_type" property="logQualityType" jdbcType="INTEGER" />
   </resultMap>
   <sql id="Base_Column_List" >
     logId,
@@ -23,7 +24,8 @@
     logOperationType,
     logDesc,
     logCreateTime,
-    logUpdateTime
+    logUpdateTime,
+    log_quality_type
   </sql>
   <select id="getByInventoryLogId" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
     select 
@@ -43,6 +45,7 @@
     log_desc as logDesc,
     log_create_time as logCreateTime,
     log_update_time as logUpdateTime,
+    log_quality_type as logQualityType,
     warehouse_name as logWarehouseName
     from
     tb_rst_fm_inventory_log il
@@ -97,6 +100,9 @@
       <if test="logDesc != null and logDesc != ''" >
         log_desc = #{logDesc,jdbcType=VARCHAR},
       </if>
+      <if test="logQualityType != null and logQualityType != ''" >
+        log_quality_type = #{logQualityType,jdbcType=VARCHAR},
+      </if>
     </set>
     where logId = #{logId,jdbcType=INTEGER}
   </update>
@@ -111,7 +117,8 @@
     log_operation_type,
     log_desc,
     log_create_time,
-    log_update_time
+    log_update_time,
+    log_quality_type
     )
     values (
     #{logProductName,jdbcType=VARCHAR},
@@ -122,7 +129,8 @@
     #{logOperationType,jdbcType=INTEGER},
     #{logDesc,jdbcType=VARCHAR},
     #{logCreateTime,jdbcType=TIMESTAMP},
-    #{logUpdateTime,jdbcType=TIMESTAMP}
+    #{logUpdateTime,jdbcType=TIMESTAMP},
+    #{logQualityType,jdbcType=TIMESTAMP}
     )
   </insert>
 

+ 142 - 16
watero-rst-service/src/main/java/com/iamberry/rst/service/fm/mapper/inventoryMapper.xml

@@ -10,6 +10,15 @@
     <result column="inventory_desc" property="inventoryDesc" jdbcType="VARCHAR" />
     <result column="inventory_create_time" property="inventoryCreateTime" jdbcType="TIMESTAMP" />
     <result column="inventory_update_time" property="inventoryUpdateTime" jdbcType="TIMESTAMP" />
+    <result column="inventory_product_color_id" property="inventoryProductColorId" jdbcType="INTEGER" />
+    <result column="inventory_good_product_num" property="inventoryGoodProductNum" jdbcType="INTEGER" />
+    <result column="inventory_defective_product_num" property="inventoryDefectiveProductNum" jdbcType="INTEGER" />
+    <result column="inventory_recent_record" property="inventoryRecentRecord" jdbcType="VARCHAR" />
+    <result column="type_name" property="productTypeName" jdbcType="VARCHAR" />
+    <result column="product_number" property="productNumber" jdbcType="VARCHAR" />
+    <result column="product_abbreviation" property="productAbbreviation" jdbcType="VARCHAR" />
+    <result column="color_name" property="productColorName" jdbcType="VARCHAR" />
+    <result column="inventoryMomentumNum" property="inventoryMomentumNum" jdbcType="VARCHAR" />
   </resultMap>
   <sql id="Base_Column_List" >
     inventory_id,
@@ -19,38 +28,104 @@
     inventory_state,
     inventory_desc,
     inventory_create_time,
-    inventory_update_time
+    inventory_update_time,
+    inventory_product_color_id,
+    inventory_good_product_num,
+    inventory_defective_product_num,
+    inventory_recent_record
   </sql>
   <select id="getByInventoryId" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
     select 
-    <include refid="Base_Column_List" />
-    from tb_rst_fm_inventory
+    fi.inventory_id,
+    fi.inventory_product_name,
+    fi.inventory_product_bar,
+    fi.inventory_remaining_num,
+    fi.inventory_state,
+    fi.inventory_desc,
+    fi.inventory_create_time,
+    fi.inventory_update_time,
+    fi.inventory_product_color_id,
+    fi.inventory_good_product_num,
+    fi.inventory_defective_product_num,
+    fi.inventory_recent_record,
+    pt.type_name,
+    pi.product_number,
+    pi.product_abbreviation,
+    pc.color_name,
+    imn.inventoryMomentumNum
+    from tb_rst_fm_inventory fi
+    LEFT jOIN tb_rst_product_color pc on fi.inventory_product_color_id  = pc.color_id
+    LEFT jOIN tb_rst_product_info pi on pc.color_product_id  = pi.product_id
+    LEFT jOIN tb_rst_product_type pt on pi.product_type  = pt.type_id
+    LEFT jOIN (SELECT
+    SUM(soi.item_num) as inventoryMomentumNum,
+    item_color_id as colorId
+    FROM
+    tb_rst_sales_order_info oi
+    LEFT JOIN tb_rst_sales_order_item soi on soi.item_order_id = oi.sales_id
+
+    WHERE
+    oi.sales_shipping_status IN (0,3,11)
+    GROUP BY soi.item_color_id
+    ) imn on imn.colorId  = pc.color_id
     where inventory_id = #{inventoryId,jdbcType=INTEGER}
   </select>
   <select id="listByInventoryId" resultMap="BaseResultMap" parameterType="InventoryInfo" >
     select
-    inventory_id,
-    inventory_product_name,
-    inventory_product_bar,
-    inventory_remaining_num,
-    inventory_state,
-    inventory_desc,
-    inventory_create_time,
-    inventory_update_time
+    fi.inventory_id,
+    fi.inventory_product_name,
+    fi.inventory_product_bar,
+    fi.inventory_remaining_num,
+    fi.inventory_state,
+    fi.inventory_desc,
+    fi.inventory_create_time,
+    fi.inventory_update_time,
+    fi.inventory_product_color_id,
+    fi.inventory_good_product_num,
+    fi.inventory_defective_product_num,
+    fi.inventory_recent_record,
+    pt.type_name,
+    pi.product_number,
+    pi.product_abbreviation,
+    pc.color_name,
+    imn.inventoryMomentumNum
     from
-    tb_rst_fm_inventory
+    tb_rst_fm_inventory fi
+    LEFT jOIN tb_rst_product_color pc on fi.inventory_product_color_id  = pc.color_id
+    LEFT jOIN tb_rst_product_info pi on pc.color_product_id  = pi.product_id
+    LEFT jOIN tb_rst_product_type pt on pi.product_type  = pt.type_id
+    LEFT jOIN (SELECT
+    SUM(soi.item_num) as inventoryMomentumNum,
+    item_color_id as colorId
+    FROM
+    tb_rst_sales_order_info oi
+    LEFT JOIN tb_rst_sales_order_item soi on soi.item_order_id = oi.sales_id
+
+    WHERE
+    oi.sales_shipping_status IN (0,3,11)
+    GROUP BY soi.item_color_id
+    ) imn on imn.colorId  = pc.color_id
     <where>
       <if test="inventoryId != null and inventoryId != ''">
-        inventory_id = #{inventoryId}
+        fi.inventory_id = #{inventoryId}
       </if>
       <if test="inventoryProductName != null and inventoryProductName != ''">
-        and inventory_product_name like CONCAT('%',#{inventoryProductName},'%')
+        and fi.inventory_product_name like CONCAT('%',#{inventoryProductName},'%')
       </if>
       <if test="inventoryProductBar != null and inventoryProductBar != ''">
-        and inventory_product_bar = #{inventoryProductBar}
+        and fi.inventory_product_bar = #{inventoryProductBar}
       </if>
       <if test="inventoryState != null and inventoryState != ''">
-        and inventory_state = #{inventoryState}
+        and fi.inventory_state = #{inventoryState}
+      </if>
+      <if test="productTypeId != null and productTypeId != ''">
+        and pt.type_id = #{productTypeId}
+      </if>
+      <if test="productColorName != null and productColorName != ''">
+        and pc.color_name like  CONCAT ('%',#{productColorName},'%')
+      </if>
+      <if test="inventoryProductBar != null and inventoryProductBar != ''">
+        and pc.color_bar = #{inventoryProductBar}
       </if>
     </where>
   </select>
@@ -73,7 +148,58 @@
       <if test="inventoryDesc != null and inventoryDesc != ''" >
         inventory_desc = #{inventoryDesc,jdbcType=VARCHAR},
       </if>
+      <if test="inventoryProductColorId != null and inventoryProductColorId != ''" >
+        inventory_product_color_id = #{inventoryProductColorId,jdbcType=INTEGER},
+      </if>
+      <if test="inventoryGoodProductNum != null" >
+        inventory_good_product_num = #{inventoryGoodProductNum,jdbcType=INTEGER},
+      </if>
+      <if test="inventoryDefectiveProductNum != null" >
+        inventory_defective_product_num = #{inventoryDefectiveProductNum,jdbcType=INTEGER},
+      </if>
+      <if test="inventoryRecentRecord != null and inventoryRecentRecord != ''" >
+        inventory_recent_record = #{inventoryRecentRecord,jdbcType=INTEGER},
+      </if>
+
     </set>
     where inventory_id = #{inventoryId,jdbcType=INTEGER}
   </update>
+
+  <select id="getByInventoryByBar" resultMap="BaseResultMap" parameterType="java.lang.String" >
+    select
+    fi.inventory_id,
+    fi.inventory_product_name,
+    fi.inventory_product_bar,
+    fi.inventory_remaining_num,
+    fi.inventory_state,
+    fi.inventory_desc,
+    fi.inventory_create_time,
+    fi.inventory_update_time,
+    fi.inventory_product_color_id,
+    fi.inventory_good_product_num,
+    fi.inventory_defective_product_num,
+    fi.inventory_recent_record,
+    pt.type_name,
+    pi.product_number,
+    pi.product_abbreviation,
+    pc.color_name,
+    imn.inventoryMomentumNum
+    from tb_rst_fm_inventory fi
+    LEFT jOIN tb_rst_product_color pc on fi.inventory_product_color_id  = pc.color_id
+    LEFT jOIN tb_rst_product_info pi on pc.color_product_id  = pi.product_id
+    LEFT jOIN tb_rst_product_type pt on pi.product_type  = pt.type_id
+    LEFT jOIN (SELECT
+    SUM(soi.item_num) as inventoryMomentumNum,
+    item_color_id as colorId
+    FROM
+    tb_rst_sales_order_info oi
+    LEFT JOIN tb_rst_sales_order_item soi on soi.item_order_id = oi.sales_id
+
+    WHERE
+    oi.sales_shipping_status IN (0,3,11)
+    GROUP BY soi.item_color_id
+    ) imn on imn.colorId  = pc.color_id
+    where fi.inventory_product_bar = #{inventoryProductBar}
+  </select>
+
 </mapper>

+ 45 - 0
watero-rst-service/src/main/java/com/iamberry/rst/util/ProduceNoUtil.java

@@ -1,10 +1,14 @@
 package com.iamberry.rst.util;
 
+import com.iamberry.redis.RedisUtils;
 import com.iamberry.rst.core.pts.Produce;
+import com.iamberry.rst.faces.fm.ComplaintDetectInfoService;
 import com.iamberry.rst.service.pts.mapper.ProduceMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import javax.print.DocFlavor;
+import java.text.SimpleDateFormat;
+import java.util.Date;
 import java.util.LinkedList;
 import java.util.List;
 
@@ -14,6 +18,8 @@ import java.util.List;
  */
 public class ProduceNoUtil {
 
+    @Autowired
+    private ComplaintDetectInfoService complaintDetectInfoService;
     //0-9,a-z,A-Z 62个编号
     private final static  String[] NUMBER = {"0","1","2","3","4","5","6","7","8","9",
             "A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z",
@@ -84,4 +90,43 @@ public class ProduceNoUtil {
         }
         System.out.println(s.length);
     }
+
+
+    private static SimpleDateFormat SDF_DETECT = new SimpleDateFormat("yyyyMM");
+    /*获取redis编号前缀*/
+    private final static String SC_DETECT = "detect_";
+    /**
+     * 生成维修编号
+     * @return
+     */
+    public String detectNumber(){
+        String year = SDF_DETECT.format(new Date());
+        String detectNum = RedisUtils.get(SC_DETECT+year);
+        Integer detectNumber;
+        if(detectNum == null){
+            //查询当前月份所有维修机器
+            Integer num = complaintDetectInfoService.getDetectNum();
+            RedisUtils.put(SC_DETECT+year,num);/*
+            RedisUtils.expire(SC_DETECT+year,new Date(System.currentTimeMillis() + 2678400000L));*/
+            detectNumber = num;
+        }else{
+            detectNumber =Integer.parseInt(detectNum)+ 1;
+
+        }
+        switch (detectNumber.toString().length()){
+            case 1:
+                detectNum = "000"+detectNumber;
+                break;
+            case 2:
+                detectNum = "00"+detectNumber;
+                break;
+            case 3:
+                detectNum = "0"+detectNumber;
+                break;
+            case 4:
+                detectNum = detectNumber.toString();
+                break;
+        }
+        return year+detectNum;
+    }
 }

+ 49 - 3
watero-rst-web/src/main/java/com/iamberry/rst/controllers/cm/AdminDetectController.java

@@ -17,7 +17,10 @@ import com.iamberry.rst.faces.fm.ComplaintSignclosedInfoService;
 import com.iamberry.rst.faces.fm.ComplaintSignclosedProductInfoService;
 import com.iamberry.rst.faces.product.ProductService;
 import com.iamberry.rst.service.fm.mapper.ComplaintSignclosedInfoMapper;
+import com.iamberry.rst.util.CustomerCommonUtil;
+import com.iamberry.rst.util.ProduceNoUtil;
 import com.iamberry.rst.utils.AdminUtils;
+import com.iamberry.rst.utils.GenerateKeyUtil;
 import com.iamberry.rst.utils.StitchAttrUtil;
 import com.iamberry.wechat.tools.ResponseJson;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
@@ -56,6 +59,8 @@ public class AdminDetectController {
     private CompanyInfoService companyInfoService;
     @Autowired
     private SalesOrderService salesOrderService;
+    @Autowired
+    private GenerateKeyUtil generateKeyUtil;
     /**
      * 跳转到添加检测记录页面
      *
@@ -143,6 +148,9 @@ public class AdminDetectController {
             msg.setReturnCode(500);
             return msg;
         }*/
+        //生成维修编号
+        String number = generateKeyUtil.detectNumber();
+        detectInfo.setDetectNumber(number);
         detectInfo.setDetectState(1);
         detectInfo.setIsMaintenance(0);
         detectInfo.setDetectRenovation(0);
@@ -175,6 +183,44 @@ public class AdminDetectController {
         mv.addObject("detectItem",detectItem);
         return mv;
     }*/
+
+    /**
+     * 跳转到添加维修记录页面
+     *
+     * @return
+     */
+    @RequiresPermissions("info:update:info")
+    @RequestMapping(value = "/to_add_content")
+    public ModelAndView toAddContent(HttpServletRequest request) {
+        ModelAndView mv = new ModelAndView("cm/inspection/add_content");
+        String detectId = request.getParameter("detectId");
+        if(detectId == null || detectId.equals("")){
+            return mv;
+        }
+        ComplaintDetectInfo detectinfo = complaintDetectInfoService.getDetectById(Integer.valueOf(detectId));
+        mv.addObject("detectId",detectId);
+        mv.addObject("detectinfo",detectinfo);
+        return mv;
+    }
+
+    /**
+     * 跳转到修改QC检测结果页面
+     *
+     * @return
+     */
+    @RequiresPermissions("info:update:info")
+    @RequestMapping(value = "/to_add_QC")
+    public ModelAndView toAddQC(HttpServletRequest request) {
+        ModelAndView mv = new ModelAndView("cm/inspection/add_QC");
+        String detectId = request.getParameter("detectId");
+        if(detectId == null || detectId.equals("")){
+            return mv;
+        }
+        ComplaintDetectInfo detectinfo = complaintDetectInfoService.getDetectById(Integer.valueOf(detectId));
+        mv.addObject("detectId",detectId);
+        mv.addObject("detectinfo",detectinfo);
+        return mv;
+    }
     /**
      * 跳转到添加修改转入信息页面
      *
@@ -217,12 +263,12 @@ public class AdminDetectController {
 
 
     /**
-     * 修改检测信息备注
+     * 修改检测信息
      * @param request
      * @return
      * @throws Exception
      */
-    @RequiresPermissions("remark:add:remark")
+    @RequiresPermissions("info:update:info")
     @ResponseBody
     @RequestMapping("/update")
     public ResponseJson addRemark(HttpServletRequest request, ComplaintDetectInfo detectInfo) throws Exception {
@@ -392,8 +438,8 @@ public class AdminDetectController {
             return msg;
         }
         String detectDate = request.getParameter("detect_date");
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
         if(detectDate != null){
-            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
             detectInfo.setDetectDate(format.parse(detectDate));
         }
         String[] componentsImgs = request.getParameterValues("componentsImg");

+ 93 - 42
watero-rst-web/src/main/java/com/iamberry/rst/controllers/order/AwaitSendController.java

@@ -2,6 +2,8 @@ package com.iamberry.rst.controllers.order;
 
 import com.alibaba.fastjson.JSONObject;
 import com.iamberry.rst.core.cm.*;
+import com.iamberry.rst.core.fm.InventoryInfo;
+import com.iamberry.rst.core.fm.InventoryLog;
 import com.iamberry.rst.core.order.*;
 import com.iamberry.rst.core.page.PagedResult;
 import com.iamberry.rst.core.pts.PtsBatch;
@@ -59,8 +61,10 @@ public class AwaitSendController {
     private CustomerService customerService;
     @Autowired
     private CmRelationService cmRelationService;
-
-
+    @Autowired
+    private InventoryService inventoryService;
+    @Autowired
+    private InventoryLogService inventoryLogService;
     private static final Logger LOGGER = LoggerFactory.getLogger(AwaitSendController.class);
 
 
@@ -89,37 +93,37 @@ public class AwaitSendController {
         if(orderWarehouse == null){
             return mv;
         }
-            salesOrder.setSalesWarehouseId(orderWarehouse.getWarehouseId());
-            salesOrder.setSalesStatus(1);
-            PagedResult<SalesOrder> pagedResult = salesOrderService.listAwaitSendSalesOrderPage(pageNO, pageSize, salesOrder,totalNum == 0);
-            if (totalNum != 0) {
-                pagedResult.setTotal(totalNum);
-            }
-            // 查询订单项
-            if (pagedResult != null && pagedResult.getDataList() != null && !pagedResult.getDataList().isEmpty()) {
-                for (SalesOrder temp : pagedResult.getDataList()) {
-                    SalesOrderItem item = new SalesOrderItem();
-                    item.setItemOrderId(temp.getSalesId());
-                    temp.setSalesOrderItemList(salesOrderService.listSalesOrderItem(item));
-                }
+        salesOrder.setSalesWarehouseId(orderWarehouse.getWarehouseId());
+        salesOrder.setSalesStatus(1);
+        PagedResult<SalesOrder> pagedResult = salesOrderService.listAwaitSendSalesOrderPage(pageNO, pageSize, salesOrder,totalNum == 0);
+        if (totalNum != 0) {
+            pagedResult.setTotal(totalNum);
+        }
+        // 查询订单项
+        if (pagedResult != null && pagedResult.getDataList() != null && !pagedResult.getDataList().isEmpty()) {
+            for (SalesOrder temp : pagedResult.getDataList()) {
+                SalesOrderItem item = new SalesOrderItem();
+                item.setItemOrderId(temp.getSalesId());
+                temp.setSalesOrderItemList(salesOrderService.listSalesOrderItem(item));
             }
-            int errorOrderNum = 0;
-            // 聚合打单方式
-            Map<String, Integer> postMap = new HashMap<>();
-            List<PostInfo> postInfos = salesOrderService.listWaitPrintOrderNum(orderWarehouse.getWarehouseId());
-            if (postInfos != null && !postInfos.isEmpty()) {
-                for (PostInfo temp : postInfos) {
-                    LogisticsInfo info = new LogisticsInfo();
-                    info.setLogisticsRstCode(temp.getPostFirm());
-                    List<LogisticsInfo> logisticsInfos = salesOrderService.getLogisticsInfo(info);
-                    if (logisticsInfos == null || logisticsInfos.size() <= 0) {
-                        errorOrderNum ++;
-                        continue;
-                    }
-                    String key = logisticsInfos.get(0).getLogisticsName();
-                    postMap.put(key, temp.getNumber());
+        }
+        int errorOrderNum = 0;
+        // 聚合打单方式
+        Map<String, Integer> postMap = new HashMap<>();
+        List<PostInfo> postInfos = salesOrderService.listWaitPrintOrderNum(orderWarehouse.getWarehouseId());
+        if (postInfos != null && !postInfos.isEmpty()) {
+            for (PostInfo temp : postInfos) {
+                LogisticsInfo info = new LogisticsInfo();
+                info.setLogisticsRstCode(temp.getPostFirm());
+                List<LogisticsInfo> logisticsInfos = salesOrderService.getLogisticsInfo(info);
+                if (logisticsInfos == null || logisticsInfos.size() <= 0) {
+                    errorOrderNum ++;
+                    continue;
                 }
+                String key = logisticsInfos.get(0).getLogisticsName();
+                postMap.put(key, temp.getNumber());
             }
+        }
         List<ProductColor> productColorList = productService.listproductAndColor(new ProductColor());
 
         salesOrder.setSalesOrderItemList(null);
@@ -263,6 +267,11 @@ public class AwaitSendController {
             //德邦 (360特惠件)
             eOrderRequestData.CustomerName = ("651476854");
             eOrderRequestData.ExpType = ("2");
+        } else if (post.equalsIgnoreCase("SDDB")) {
+            // 上朵德邦(标准快递)
+            eOrderRequestData.CustomerName = ("S20140809-60390596");
+            eOrderRequestData.ExpType = ("3");
+            eOrderRequestData.ShipperCode = "DBL";
         }
         LOGGER.info( "===salesId:" + salesId + "快递方式:" + post+ "订单编号:"+ orderId);
         // 收件人信息
@@ -270,6 +279,7 @@ public class AwaitSendController {
         if (addrs.length <= 3) {
             addrs = salesOrderInfo.getSalesAddressInfo().split("-");
         }
+        String addrDetails = salesOrderInfo.getSalesAddressInfo().substring(addrs[0].length() + addrs[1].length() + addrs[2].length() + 3);
         // 获取收件人邮编
         String postCode = AddrUtil.getPostCode(addrs[2]);
         if (postCode == null || "".equals(postCode)) {
@@ -285,7 +295,7 @@ public class AwaitSendController {
         receiver.put("ProvinceName", AddrUtil.dealProvince(addrs[0]));
         receiver.put("CityName", addrs[1]);
         receiver.put("ExpAreaName", addrs[2]);
-        receiver.put("Address", salesOrderInfo.getSalesAddressInfo());
+        receiver.put("Address", addrDetails);
         receiver.put("PostCode", postCode);
         eOrderRequestData.Receiver = (receiver);
         // 发件人信息
@@ -307,12 +317,12 @@ public class AwaitSendController {
         Double colorIsWeight = 0.00;
         StringBuilder goodName = new StringBuilder();
         // 2018-12-21 增加打印面单需求:判断是否为维修机
-        if (salesOrderInfo.getSalesCustomerId() != null) {
+        /*if (salesOrderInfo.getSalesCustomerId() != null) {
             CustomerInfo customerInfo = customerService.getCustomerInfo(salesOrderInfo.getSalesCustomerId());
             if (customerInfo != null && customerInfo.getCustomerIsSolve() != null && customerInfo.getCustomerIsSolve() == 4) {
                 goodName.append("【原机返回】");
             }
-        }
+        }*/
         int Goodsquantity = 0;
         for (SalesOrderItem temp : items) {
             goodName.append(temp.getProductAbbreviation())
@@ -348,7 +358,7 @@ public class AwaitSendController {
 
                 // 订单发货
                 SalesOrder salesOrder = new SalesOrder();
-                salesOrder.setSalesPostFirm(eOrderRequestData.ShipperCode);
+                //salesOrder.setSalesPostFirm(eOrderRequestData.ShipperCode);
                 salesOrder.setSalesPostNum(code);
                 salesOrder.setSalesShippingStatus(1);
                 salesOrder.setSalesSendTime(new Date());
@@ -542,9 +552,16 @@ public class AwaitSendController {
                 rj.setResultMsg("出货失败,请检查该物流单号("+postNum+")和订单状态是否为已发货。");
                 return rj;
             }
-            rj = ResponseJson.getSUCCESS();
-            rj.setResultMsg("物流单号("+ postNum +")出库成功。");
-            return rj;
+            //修改库存信息
+            if(updateInventory(salesOrder.getSalesId())){
+                rj = ResponseJson.getSUCCESS();
+                rj.setResultMsg("物流单号("+ postNum +")出库成功。");
+                return rj;
+            }else{
+                rj.setResultMsg("出货失败,请检查该物流单号("+postNum+")和订单状态是否为已发货,产品库存是否充足。");
+                return rj;
+            }
+
         }
         if(salesOrder == null){
             rj.setResultMsg("出货失败,该物流单号("+postNum+")未查询到订单。");
@@ -559,10 +576,12 @@ public class AwaitSendController {
             return rj;
         }
         salesOrder.setSalesDeliver(2);
-        Integer flag = salesOrderService.updateDeliver(salesOrder);
-        if(flag < 1){
-            rj.setResultMsg("出货失败,请检查该物流单号("+postNum+")和订单状态。");
-            return rj;
+        if(updateInventory(salesOrder.getSalesId())){
+            Integer flag = salesOrderService.updateDeliver(salesOrder);
+            if(flag < 1){
+                rj.setResultMsg("出货失败,请检查该物流单号("+postNum+")和订单状态,产品库存是否充足。");
+                return rj;
+            }
         }
         //查询出库的产品项
         List<SalesOrderItem> itemList = salesOrderService.selectSalesOrderItemList(salesOrder.getSalesId());
@@ -572,6 +591,38 @@ public class AwaitSendController {
         return rj;
     }
 
+    public boolean updateInventory(Integer salesId){
+        SalesOrderItem salesOrderItem = new SalesOrderItem();
+        salesOrderItem.setItemOrderId(salesId);
+        List<SalesOrderItem> listOrderitem = salesOrderService.listSalesOrderItem(salesOrderItem);
+        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        for(SalesOrderItem item : listOrderitem){
+            InventoryInfo info = inventoryService.getByInventoryByBar(item.getItemColorBar());
+            if(info != null){
+                if(info.getInventoryGoodProductNum() >= item.getItemNum()){
+                    info.setInventoryGoodProductNum(info.getInventoryGoodProductNum() - item.getItemNum());
+                    info.setInventoryRecentRecord(sdf.format(new Date())+"出库:"+item.getItemNum()+"件");
+                    inventoryService.updateById(info);
+                    //添加日志
+                    InventoryLog inventoryLog = new InventoryLog();
+                    inventoryLog.setLogProductName(info.getInventoryProductName());
+                    inventoryLog.setLogProductBar(info.getInventoryProductBar());
+                    inventoryLog.setLogRemainingNum(item.getItemNum());
+                    inventoryLog.setLogType(2);
+                    inventoryLog.setLogOperationType(2);
+                    inventoryLog.setLogDesc(sdf.format(new Date())+"手动出库:"+item.getItemNum()+"件");
+                    inventoryLog.setLogQualityType(1);
+                    inventoryLog.setLogWarehouseId(1);
+                    inventoryLogService.insert(inventoryLog);
+                }else{
+                    return false;
+                }
+            }
+
+        }
+        return true;
+    }
+
     /**
      * 出库
      * @param request
@@ -979,7 +1030,7 @@ public class AwaitSendController {
                 if(salesOrder.getSalesDeliver() == null){
                     salesDeliver = "未出库";
                 }else{
-                   ///出库状态  1:未出库   2:已出库
+                    ///出库状态  1:未出库   2:已出库
                     switch (salesOrder.getSalesDeliver()){
                         case 1:
                             salesDeliver = "未出库";

+ 97 - 19
watero-rst-web/src/main/java/com/iamberry/rst/controllers/pts/InventoryController.java

@@ -3,10 +3,15 @@ package com.iamberry.rst.controllers.pts;
 import com.iamberry.rst.core.fm.InventoryInfo;
 import com.iamberry.rst.core.fm.InventoryLog;
 import com.iamberry.rst.core.fm.WarehouseInfo;
+import com.iamberry.rst.core.order.Product;
+import com.iamberry.rst.core.order.ProductColor;
+import com.iamberry.rst.core.order.ProductType;
 import com.iamberry.rst.core.page.PageRequest;
 import com.iamberry.rst.core.page.PagedResult;
 import com.iamberry.rst.faces.cm.InventoryLogService;
 import com.iamberry.rst.faces.cm.InventoryService;
+import com.iamberry.rst.faces.product.ProductColorService;
+import com.iamberry.rst.faces.product.ProductService;
 import com.iamberry.rst.utils.StitchAttrUtil;
 import com.iamberry.wechat.tools.ResponseJson;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
@@ -18,6 +23,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
+import java.text.SimpleDateFormat;
 import java.util.*;
 
 /**
@@ -30,6 +36,10 @@ public class InventoryController {
     private InventoryService inventoryService;
     @Autowired
     private InventoryLogService inventoryLogService;
+    @Autowired
+    private ProductService productService;
+    @Autowired
+    private ProductColorService productColorService;
 
     /**
      * 查询库存列表信息
@@ -53,8 +63,14 @@ public class InventoryController {
         StringBuilder url = new StringBuilder("/admin/inventory/select_inventory_list?pageSize=" + pageSize);
         // 封装请求数据
         PageRequest<InventoryInfo> pageRequest = new PageRequest<>(inventoryInfo, pageNO, pageSize, pageTotal == null);
-        // 查询订单列表
+        // 查询库存列表
         PagedResult<InventoryInfo> result = inventoryService.listByInventoryId(pageRequest);
+        ProductColor color = new ProductColor();
+        List<ProductColor> productColorList = productService.listProduceColor(color);
+        mv.addObject("productColorList",productColorList);
+        ProductType productType = new ProductType();
+        List<ProductType> productTypeList = productService.listProductType(productType);
+        mv.addObject("productTypeList",productTypeList);
         long total = 0;
         if (pageTotal == null) {
             total = result.getPages();
@@ -97,10 +113,10 @@ public class InventoryController {
             total = pageTotal;
             result.setPages(total);
         }
-        //查询所有仓库
+        /*//查询所有仓库
         List<WarehouseInfo> warehouseList = inventoryLogService.listFactoryInfo();
-        mv.addObject("warehouseList",warehouseList);
-        StitchAttrUtil.getSa().setModelAndView(inventoryLog, mv, "/admin/Inventory/select_InventoryLog_list", result);
+        mv.addObject("warehouseList",warehouseList);*/
+        StitchAttrUtil.getSa().setModelAndView(inventoryLog, mv, "/admin/inventory/select_inventoryLog_list", result);
         return mv;
     }
 
@@ -133,34 +149,71 @@ public class InventoryController {
     @ResponseBody
     @RequiresPermissions("signclosed:select:signclosed")
     @RequestMapping(value = "/update_num")
-    public ResponseJson updateRemark(HttpServletRequest request,InventoryInfo inventoryInfo,Integer operationType,Integer type){
+    public ResponseJson updateRemark(HttpServletRequest request,InventoryInfo inventoryInfo){
         ResponseJson msg = new ResponseJson();
         if(inventoryInfo == null){
             msg.setResultCode(500);
             msg.setReturnCode(500);
             return msg;
         }
+        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         InventoryLog inventoryLog = new InventoryLog();
         InventoryInfo info = inventoryService.getByInventoryId(inventoryInfo.getInventoryId());
-        if(operationType == 1){//增加
-            info.setInventoryRemainingNum(info.getInventoryRemainingNum()+inventoryInfo.getInventoryRemainingNum());
+        if(inventoryInfo.getOperationType() == 1){//出库
+                if(inventoryInfo.getQualityType() == 1){//良品
+                    if(info.getInventoryGoodProductNum() >= inventoryInfo.getOperationNum()){
+                        info.setInventoryGoodProductNum(info.getInventoryGoodProductNum()-inventoryInfo.getOperationNum());
+                        info.setInventoryRecentRecord(sdf.format(new Date())+"良品出库:"+inventoryInfo.getOperationNum()+"件");
+                        inventoryLog.setLogType(2);
+                        inventoryLog.setLogQualityType(1);
+                    }else{
+                        msg.setResultCode(500);
+                        msg.setReturnCode(502);
+                        return msg;
+                    }
+                }else{//不良品
+                    if(info.getInventoryDefectiveProductNum() >= inventoryInfo.getOperationNum()){
+                        info.setInventoryDefectiveProductNum(info.getInventoryDefectiveProductNum()-inventoryInfo.getOperationNum());
+                        info.setInventoryRecentRecord(sdf.format(new Date())+"不良品出库:"+inventoryInfo.getOperationNum()+"件");
+                        inventoryLog.setLogType(3);
+                        inventoryLog.setLogQualityType(2);
+                    }else{
+                        msg.setResultCode(500);
+                        msg.setReturnCode(502);
+                        return msg;
+                    }
+                }
+                inventoryLog.setLogOperationType(2);
+
+
+
+        }else if(inventoryInfo.getOperationType() == 2){//入库
+            if(inventoryInfo.getQualityType() == 1){//良品
+                info.setInventoryGoodProductNum(info.getInventoryGoodProductNum()+inventoryInfo.getOperationNum());
+                info.setInventoryRecentRecord(sdf.format(new Date())+"良品入库:"+inventoryInfo.getOperationNum()+"件");
+                inventoryLog.setLogType(1);
+                inventoryLog.setLogQualityType(1);
+            }else{//不良品
+                info.setInventoryDefectiveProductNum(info.getInventoryDefectiveProductNum()+inventoryInfo.getOperationNum());
+                info.setInventoryRecentRecord(sdf.format(new Date())+"不良品入库:"+inventoryInfo.getOperationNum()+"件");
+                inventoryLog.setLogType(3);
+                inventoryLog.setLogQualityType(2);
+            }
             inventoryLog.setLogOperationType(1);
-        }else if(operationType == 2){//减少
-            info.setInventoryRemainingNum(info.getInventoryRemainingNum()-inventoryInfo.getInventoryRemainingNum());
-            inventoryLog.setLogOperationType(2);
         }
-        Integer num = inventoryService.updateById(inventoryInfo);
+        Integer num = inventoryService.updateById(info);
         if (num < 1) {
             msg.setResultCode(500);
-            msg.setReturnCode(500);
+            msg.setReturnCode(501);
         } else {
             msg.setResultCode(200);
             msg.setReturnCode(200);
             inventoryLog.setLogCreateTime(new Date());
             inventoryLog.setLogProductBar(info.getInventoryProductBar());
             inventoryLog.setLogProductName(info.getInventoryProductName());
-            inventoryLog.setLogType(type);
+            inventoryLog.setLogDesc(inventoryInfo.getInventoryDesc());
             inventoryLog.setLogWarehouseId(inventoryInfo.getInventoryId());
+            inventoryLog.setLogRemainingNum(inventoryInfo.getOperationNum());
             inventoryLogService.insert(inventoryLog);
         }
         return msg;
@@ -172,19 +225,44 @@ public class InventoryController {
      *
      * @return
      */
+    @ResponseBody
     @RequiresPermissions("signclosed:update:signclosed")
     @RequestMapping(value = "/to_update_inventory")
-    public ModelAndView toUpdateInventory(HttpServletRequest request,Integer inventoryId) {
+    public ModelAndView toUpdateInventory(HttpServletRequest request,Integer inventoryId,Integer operationType) {
         ModelAndView mv = new ModelAndView("cm/inventory/update_inventory");
         if(inventoryId == null){
             return mv;
         }
-        //查询所有仓库
-        List<WarehouseInfo> warehouseList = inventoryLogService.listFactoryInfo();
-        InventoryInfo info = inventoryService.getByInventoryId(inventoryId);
-        mv.addObject("warehouseList",warehouseList);
-        mv.addObject("info",info);
+        InventoryInfo inventoryInfo = inventoryService.getByInventoryId(inventoryId);
+        mv.addObject("inventoryInfo",inventoryInfo);
+        mv.addObject("operationType",operationType);
         return mv;
     }
+    /**
+     * 添加产品数据到库存表
+     *
+     * @return
+     */
+    @ResponseBody
+    @RequestMapping(value = "/addInventory")
+    public String toUpdateInventory(HttpServletRequest request) {
+        ProductColor color = new ProductColor();
+        List<ProductColor> listColor  = productColorService.getProductColorList(color);
+        for(ProductColor productColor : listColor){
+            Product product = productService.getProductById(productColor.getColorId());
+            InventoryInfo inventoryInfo = new InventoryInfo();
+            inventoryInfo.setInventoryProductName(product.getProductName());
+            inventoryInfo.setInventoryProductBar(productColor.getColorBar());
+            inventoryInfo.setInventoryRemainingNum(0);
+            inventoryInfo.setInventoryState(1);
+            inventoryInfo.setInventoryProductColorId(productColor.getColorId());
+            inventoryInfo.setInventoryGoodProductNum(0);
+            inventoryInfo.setInventoryDefectiveProductNum(0);
+
+        }
+        return "";
+    }
+
+
 
 }

+ 44 - 0
watero-rst-web/src/main/java/com/iamberry/rst/utils/GenerateKeyUtil.java

@@ -1,8 +1,10 @@
 package com.iamberry.rst.utils;
 
+import com.iamberry.redis.RedisUtils;
 import com.iamberry.rst.core.cm.SalesOrder;
 import com.iamberry.rst.core.sys.SysConfig;
 import com.iamberry.rst.faces.cm.SalesOrderService;
+import com.iamberry.rst.faces.fm.ComplaintDetectInfoService;
 import com.iamberry.rst.faces.order.OrderBatchService;
 import com.iamberry.rst.faces.sys.SysConfigService;
 import com.iamberry.wechat.tools.StaticInfo;
@@ -31,6 +33,8 @@ public class GenerateKeyUtil {
     private SalesOrderService salesOrderService;
     @Autowired
     private SysConfigService sysConfigService;
+    @Autowired
+    private ComplaintDetectInfoService complaintDetectInfoService;
 
 
     private Calendar calendar;
@@ -38,6 +42,7 @@ public class GenerateKeyUtil {
     private final static Integer orderNo = 3;
     private final static Integer bacthNo = 4;
     private final static Integer scmOrderMadeNo= 5; //
+    private final static Integer detectNo= 6; //
 
     private static SimpleDateFormat SDF_ORDERID = new SimpleDateFormat("yyMMdd");
 
@@ -45,6 +50,8 @@ public class GenerateKeyUtil {
 
     private static SimpleDateFormat SDF_BATCH = new SimpleDateFormat("yyMMdd");
 
+    private static SimpleDateFormat SDF_DETECT = new SimpleDateFormat("yyyyMM");
+
     /*订单交易号前两位,D标识一定为手动增加  */
     private final static String SD_ORDER = "D";
 
@@ -54,6 +61,8 @@ public class GenerateKeyUtil {
     private final static String SD_BATCH = "D";
     /*批量添加批次编号*/
     private final static String SC_BATCH = "C";
+    /*获取redis编号前缀*/
+    private final static String SC_DETECT = "detect_";
 
     private static char[] chars = {
             'G', 'I', 'J', 'K', 'L', 'M', 'N', 'U', 'V', 'W', 'Y', 'Z',
@@ -214,5 +223,40 @@ public class GenerateKeyUtil {
         return false;
     }
 
+    /**
+     * 生成维修编号
+     * @return
+     */
+    public String detectNumber(){
+        String year = SDF_DETECT.format(new Date());
+        String detectNum = RedisUtils.get(SC_DETECT+year);
+        Integer detectNumber;
+        if(detectNum == null){
+            //查询当前月份所有维修机器
+            Integer num = complaintDetectInfoService.getDetectNum();
+            RedisUtils.put(SC_DETECT+year,num);
+            /*RedisUtils.expire(SC_DETECT+year,new Date(System.currentTimeMillis() + 2678400000L));*/
+            detectNumber = num;
+        }else{
+            detectNumber =Integer.parseInt(detectNum)+ 1;
+            RedisUtils.put(SC_DETECT+year,detectNumber);
+        }
+        switch (detectNumber.toString().length()){
+            case 1:
+                detectNum = "000"+detectNumber;
+                break;
+            case 2:
+                detectNum = "00"+detectNumber;
+                break;
+            case 3:
+                detectNum = "0"+detectNumber;
+                break;
+            case 4:
+                detectNum = detectNumber.toString();
+                break;
+        }
+        return year+detectNum;
+    }
+
 
 }

+ 7 - 1
watero-rst-web/src/main/resources/platform.properties

@@ -127,4 +127,10 @@ JD_ORDER=1
 #NUONUO_URL=https://sandbox.jss.com.cn/openPlatform/services
 #NUONUO_ID=1
 #
-
+redis_host=120.76.99.239
+redis_port=6379
+redis_auth=AiberleRedis&*()
+redis_max_active=200
+redis_max_idle=10
+redis_max_wait=2000
+redis_timeout=300

+ 1 - 1
watero-rst-web/src/main/webapp/WEB-INF/views/cm/customer/add_customer.ftl

@@ -1,4 +1,4 @@
-f<!DOCTYPE HTML>
+<!DOCTYPE HTML>
 <html>
 <head>
     <meta charset="utf-8">

+ 3 - 0
watero-rst-web/src/main/webapp/WEB-INF/views/cm/customer/update_relation.ftl

@@ -240,6 +240,9 @@
                     <strong>寄回信息</strong>
                 </div>
                 <div class="formControls col-12 col-sm-12">
+                    <div class="formControls col-2 col-sm-2 text-r">
+                        <strong>寄回状态</strong>
+                    </div>
                     <div class="radio-box">
                         <input type="radio" id="tel-c1" name="sendbackStatuss" value="1">
                         <label for="tel-c1">未寄回</label>

+ 92 - 0
watero-rst-web/src/main/webapp/WEB-INF/views/cm/inspection/add_QC.ftl

@@ -0,0 +1,92 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+    <meta charset="utf-8">
+    <meta name="renderer" content="webkit|ie-comp|ie-stand">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
+    <meta http-equiv="Cache-Control" content="no-siteapp" />
+<#include "/base/add_base.ftl">
+    <title>QC检测状态 - H-ui.filter v2.4</title>
+    <style>
+        .my-title{font-weight: 500;padding-left: 15px;position: relative;}
+        .my-title:after{content: '';position: absolute;left: 0;top:12%;width: 3px;height: 80%;background: #32a3d8;}
+        .my-input{padding: 8px 5px;width: 80%;border:1px solid rgba(0,0,0,.1);}
+        .my-input-date{padding: 8px 10px;border:1px solid rgba(0,0,0,.1);width: 80%;background: url(http://s.iamberry.com/images/rili-1.png) 98.5% center no-repeat; background-size:auto 50%;}
+        .input-box{margin: 18px 0;}
+        .input-dic{float: left;margin:5px 10px 0 0;font-size: 12px;}
+        .add-list{list-style-type: none;padding: 10px;background-color: #f5f5f5;width: 60%;float: left;margin: 0;}
+        .add-list>li{margin: 10px 0;}
+        .my-textarea{padding: 5px 10px;width: 80%;border:1px solid rgba(0,0,0,.1);}
+        .my-btn-reset{padding: 10px 20px;width: 150px; background-color: #fff;color: #32a3d8;border: 1px solid #32a3d8;cursor:pointer;margin: 10px 10px 0 10px;}
+        .my-btn-submit{padding: 10px 20px;width: 150px; background-color: #32a3d8;color: #fff;border: 1px solid #32a3d8;cursor:pointer;margin: 10px 10px 0 10px;}
+        .my-select{border: 1px solid rgba(0,0,0,.1);padding:6px 50px 6px 15px;height: 34px; -webkit-appearance:none;appearance:none;background: url(/common/images/pts/select-11.png) right center no-repeat;background-size:auto 100%;}
+        input[type=radio]{-webkit-appearance:none;appearance:none;background: url(/common/images/pts/radio-1.png) center center no-repeat;background-size:auto 100%;width: 20px;height: 20px;margin-right: 10px;}
+        input[type=radio]:checked{-webkit-appearance:none;appearance:none;background: url(/common/images/pts/radio-2.png) center center no-repeat;background-size:auto 100%;width: 20px;height: 20px;margin-right: 10px;}
+    </style>
+    <meta name="keywords" content="${path}">
+    <meta name="description" content="H-ui.admin v3.0,是一款由国人开发的轻量级扁平化网站后台模板,完全免费开源的网站后台管理系统模版,适合中小型CMS后台系统。">
+</head>
+<body>
+<article class="page-container">
+    <form class="form form-horizontal" id="form-admin-add">
+        <div class="row cl">
+            <div class="formControls col-12 col-sm-12">
+                <strong>QC检测状态</strong>
+                <div class="radio-box">
+                    <input type="radio" id="tel-b1" name="maintenanceResults" value="1" checked >
+                    <label for="tel-b1">通过</label>
+                </div>
+                <div class="radio-box">
+                    <input type="radio" id="tel-b2" name="maintenanceResults" value="2">
+                    <label for="tel-b2">不通过</label>
+                </div>
+            </div>
+        </div>
+        <#--<div style="text-align:center;">
+            <span>如果转入生产,则生产部门同事可查看!</span>
+        </div>-->
+        <div style="text-align:center;">
+            <input type="hidden" value="${detectId!''}" id="detectId" name="detectId">
+           <button type="button" class="my-btn-submit" onclick="add();">确认提交</button>
+        </div>
+    </form>
+</article>
+<script type="text/javascript" src="${path}/common/lib/My97DatePicker/4.8/WdatePicker.js"></script>
+<script type="text/javascript">
+
+
+    function  add() {
+        /*var detectItemDesc = $("#detectItemDesc").val();
+        if( detectItemDesc != null){
+            if( detectItemDesc.length > 200 ){
+                layer.msg('备注长度不得大于100个字符',{icon: 5,time:1000});
+                return;
+            }
+        }*/
+
+        $.ajax({
+            cache: true,
+            type: "POST",
+            url: "${path}/admin/detect/update",
+            data:$('#form-admin-add').serialize(),// 你的formid
+            async: false,
+            success: function(data){
+                if (data.returnCode == 200) {
+                    layer.msg('操作成功',{icon: 1,time:1000},function () {
+                        window.parent.location.reload();
+                        var index = parent.layer.getFrameIndex(window.name);
+                        parent.layer.close(index)
+                    });
+                } else {
+                    layer.msg('操作失败',{icon: 5,time:1000});
+                }
+            },
+            error: function(XmlHttpRequest, textStatus, errorThrown){
+                layer.msg('操作错误',{icon: 5,time:1000});
+            }
+        });
+    }
+</script>
+</body>
+</html>

+ 87 - 0
watero-rst-web/src/main/webapp/WEB-INF/views/cm/inspection/add_content.ftl

@@ -0,0 +1,87 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+    <meta charset="utf-8">
+    <meta name="renderer" content="webkit|ie-comp|ie-stand">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
+    <meta http-equiv="Cache-Control" content="no-siteapp" />
+<#include "/base/add_base.ftl">
+    <title>维修记录 - H-ui.filter v2.4</title>
+    <style>
+        .my-title{font-weight: 500;padding-left: 15px;position: relative;}
+        .my-title:after{content: '';position: absolute;left: 0;top:12%;width: 3px;height: 80%;background: #32a3d8;}
+        .my-input{padding: 8px 5px;width: 80%;border:1px solid rgba(0,0,0,.1);}
+        .my-input-date{padding: 8px 10px;border:1px solid rgba(0,0,0,.1);width: 80%;background: url(http://s.iamberry.com/images/rili-1.png) 98.5% center no-repeat; background-size:auto 50%;}
+        .input-box{margin: 18px 0;}
+        .input-dic{float: left;margin:5px 10px 0 0;font-size: 12px;}
+        .add-list{list-style-type: none;padding: 10px;background-color: #f5f5f5;width: 60%;float: left;margin: 0;}
+        .add-list>li{margin: 10px 0;}
+        .my-textarea{padding: 5px 10px;width: 80%;border:1px solid rgba(0,0,0,.1);}
+        .my-btn-reset{padding: 10px 20px;width: 150px; background-color: #fff;color: #32a3d8;border: 1px solid #32a3d8;cursor:pointer;margin: 10px 10px 0 10px;}
+        .my-btn-submit{padding: 10px 20px;width: 150px; background-color: #32a3d8;color: #fff;border: 1px solid #32a3d8;cursor:pointer;margin: 10px 10px 0 10px;}
+        .my-select{border: 1px solid rgba(0,0,0,.1);padding:6px 50px 6px 15px;height: 34px; -webkit-appearance:none;appearance:none;background: url(/common/images/pts/select-11.png) right center no-repeat;background-size:auto 100%;}
+        input[type=radio]{-webkit-appearance:none;appearance:none;background: url(/common/images/pts/radio-1.png) center center no-repeat;background-size:auto 100%;width: 20px;height: 20px;margin-right: 10px;}
+        input[type=radio]:checked{-webkit-appearance:none;appearance:none;background: url(/common/images/pts/radio-2.png) center center no-repeat;background-size:auto 100%;width: 20px;height: 20px;margin-right: 10px;}
+    </style>
+    <meta name="keywords" content="${path}">
+    <meta name="description" content="H-ui.admin v3.0,是一款由国人开发的轻量级扁平化网站后台模板,完全免费开源的网站后台管理系统模版,适合中小型CMS后台系统。">
+</head>
+<body>
+<article class="page-container">
+    <form class="form form-horizontal" id="form-admin-add">
+        <div class="input-box"   style="text-align:center;">
+            <span class="input-dic spanhidth">维修记录</span>
+            <#if detectinfo??>
+                <textarea rows="5" cols="20" name="detectContent" id="detectContent" class="my-textarea" placeholder="请输入维修记录!">${detectinfo.detectContent!''}</textarea>
+            <#else>
+                <textarea rows="5" cols="20" name="detectContent" id="detectContent" class="my-textarea" placeholder="请输入维修记录!"></textarea>
+            </#if>
+        </div>
+        <#--<div style="text-align:center;">
+            <span>如果转入生产,则生产部门同事可查看!</span>
+        </div>-->
+        <div style="text-align:center;">
+            <input type="hidden" value="${detectId!''}" id="detectId" name="detectId">
+           <button type="button" class="my-btn-submit" onclick="add();">确认提交</button>
+        </div>
+    </form>
+</article>
+<script type="text/javascript" src="${path}/common/lib/My97DatePicker/4.8/WdatePicker.js"></script>
+<script type="text/javascript">
+
+
+    function  add() {
+        /*var detectItemDesc = $("#detectItemDesc").val();
+        if( detectItemDesc != null){
+            if( detectItemDesc.length > 200 ){
+                layer.msg('备注长度不得大于100个字符',{icon: 5,time:1000});
+                return;
+            }
+        }*/
+
+        $.ajax({
+            cache: true,
+            type: "POST",
+            url: "${path}/admin/detect/update",
+            data:$('#form-admin-add').serialize(),// 你的formid
+            async: false,
+            success: function(data){
+                if (data.returnCode == 200) {
+                    layer.msg('操作成功',{icon: 1,time:1000},function () {
+                        window.parent.location.reload();
+                        var index = parent.layer.getFrameIndex(window.name);
+                        parent.layer.close(index)
+                    });
+                } else {
+                    layer.msg('操作失败',{icon: 5,time:1000});
+                }
+            },
+            error: function(XmlHttpRequest, textStatus, errorThrown){
+                layer.msg('操作错误',{icon: 5,time:1000});
+            }
+        });
+    }
+</script>
+</body>
+</html>

+ 11 - 7
watero-rst-web/src/main/webapp/WEB-INF/views/cm/inspection/detect_list.ftl

@@ -130,7 +130,7 @@
             <thead>
             <tr class="text-c">
                 <#--<th width="100">客诉编号</th>-->
-                <th width="100">检测ID</th>
+                <th width="100">检测编号</th>
                 <th width="100">客诉处理</th>
                 <th width="100">产品</th>
                 <th width="100">当前状态</th>
@@ -158,7 +158,7 @@
                 <#list page.dataList as detect>
                 <tr>
                     <#--<td class="text-c" width="100">${detect.customerId!}</td>-->
-                    <td class="text-c" width="100">${detect.detectId!''}</td>
+                    <td class="text-c" width="100">${detect.detectNumber!''}</td>
                     <td class="text-c" width="100"><#if detect.customerId??>${detect.procTypeName!''}-${detect.procMethodName!''}</#if></td>
                     <td class="text-c" width="100">${detect.productName!'暂无产品'}(${detect.colorName!'暂无颜色'})</td>
                     <td class="text-c" width="100">
@@ -239,10 +239,14 @@
                     <td class="text-c" width="100">${(detect.detectDate?string("yyyy-MM-dd"))!'-'}</td>
                     <!-- 遍历操作 -->
                     <td class="td-manage text-c" width="120">
-                        <#--<a style="text-decoration:none" href="javascript:;" title="修改备注"
-                           onclick="add_remark('修改备注','${path}/admin/detect/update?detectId=${detect.detectId!''}','570','450');">
-                            <i class="Hui-iconfont">&#xe6df;</i>
-                        </a>-->
+                        <a style="text-decoration:none" href="javascript:;" title="维修记录"
+                           onclick="add_remark('维修记录','${path}/admin/detect/to_add_content?detectId=${detect.detectId!''}','570','450');">
+                            <i class="Hui-iconfont">维修记录</i>
+                        </a><br>
+                        <a style="text-decoration:none" href="javascript:;" title="QC检测"
+                           onclick="add_remark('QC检测','${path}/admin/detect/to_add_QC?detectId=${detect.detectId!''}','570','450');">
+                            <i class="Hui-iconfont">QC检测</i>
+                        </a><br>
                         <#--<a style="text-decoration:none" href="javascript:;" title="删除"
                            onclick="detele(${detect.detectId!''});">
                             <i class="Hui-iconfont">&#xe609;</i>
@@ -433,7 +437,7 @@
                     $("#questionTitleTd").html("");
                     $("#date").html("");
 
-                    $("#detectIdTd").html(detectInfo.detectId);
+                    $("#detectIdTd").html(detectInfo.detectNumber);
                     if(null != signclosedInfo && "" !=signclosedInfo){
                         if(signclosedInfo.signclosedSendName != null && signclosedInfo.signclosedSendName != ""){
                             $("#signclosedSendNameTd").html(signclosedInfo.signclosedSendName);

+ 60 - 3
watero-rst-web/src/main/webapp/WEB-INF/views/cm/inspection/update_complete.ftl

@@ -58,6 +58,63 @@
                 </div>
             </div>
         </div>
+        <div class="input-box" style="margin-top: 20px;">
+            <label class="col-3 col-sm-3 huanhang" style="text-align: right;margin: 10px 0px;">厚膜类型:</label>
+            <div class=" col-xs-9 col-sm-9  huanhang" >
+                <div class="radio-box" style="margin: 10px 0px;">
+                    <input type="radio" id="radio-9" name="detectFilmType" value="1"  checked
+                          <#if detectInfo.detectFilmType??><#if detectInfo.detectFilmType == 1>checked</#if></#if>/><label for="radio-9">圆</label>
+                </div>
+                <div class="radio-box">
+                    <input type="radio" id="radio-10" name="detectFilmType" value="2"
+                    <#if detectInfo.detectFilmType??><#if detectInfo.detectFilmType == 2>checked</#if></#if>/><label for="radio-10">扁</label>
+                </div>
+            </div>
+        </div>
+        <div class="input-box" style="margin-top: 20px;">
+            <label class="col-3 col-sm-3 huanhang" style="text-align: right;margin: 10px 0px;">浮子类型:</label>
+            <div class=" col-xs-9 col-sm-9  huanhang" >
+                <div class="radio-box" style="margin: 10px 0px;">
+                    <input type="radio" id="radio-11" name="detectFloatType" value="1"  checked
+                          <#if detectInfo.detectFloatType??><#if detectInfo.detectFloatType == 1>checked</#if></#if>/><label for="radio-11">长</label>
+                </div>
+                <div class="radio-box">
+                    <input type="radio" id="radio-12" name="detectFloatType" value="2"
+                    <#if detectInfo.detectFloatType??><#if detectInfo.detectFloatType == 2>checked</#if></#if>/><label for="radio-12">短</label>
+                </div>
+            </div>
+        </div>
+        <div class="input-box" style="margin-top: 20px;">
+            <label class="col-3 col-sm-3 huanhang" style="text-align: right;margin: 10px 0px;">是否翻新机:</label>
+            <div class=" col-xs-9 col-sm-9  huanhang" >
+                <div class="radio-box" style="margin: 10px 0px;">
+                    <input type="radio" id="radio-13" name="detectIsRefurbishing" value="1"  checked
+                          <#if detectInfo.detectIsRefurbishing??><#if detectInfo.detectIsRefurbishing == 1>checked</#if></#if>/><label for="radio-13">是</label>
+                </div>
+                <div class="radio-box">
+                    <input type="radio" id="radio-14" name="detectIsRefurbishing" value="2"
+                    <#if detectInfo.detectIsRefurbishing??><#if detectInfo.detectIsRefurbishing == 2>checked</#if></#if>/><label for="radio-14">否</label>
+                </div>
+            </div>
+        </div>
+        <div class="input-box">
+            <label class="form-label col-3 col-sm-3 huanhang" style="text-align: right;margin: 10px 0px;">生产月份:</label>
+            <div class="formControls col-9 col-sm-9 text-c huanhang" style="margin-left: -4%;margin: 10px 0px 10px -14px;">
+                <input class="my-input" style="width: 90%;" type="text" value="" name="detectProduction" id="detectProduction" onClick="WdatePicker({skin:'whyGreen',maxDate:'%y-%M',dateFmt: 'yyyy-MM'})" placeholder="请选择月份" readonly="readonly"/>
+            </div>
+        </div>
+        <div class="input-box" >
+            <label class="col-3 col-sm-3 huanhang" style="text-align: right;margin: 10px 0px;">机身条码:</label>
+            <div class="formControls col-xs-9 col-sm-9 skin-minimal huanhang" style="margin: 10px 0px;">
+                <input class="my-input" style="width: 90%;" type="text" value="${detectInfo.detectFuselageBarcode!''}" name="detectFuselageBarcode" id="detectFuselageBarcode"  placeholder="请输入机身条码"/>
+            </div>
+        </div>
+        <div class="input-box" >
+            <label class="col-3 col-sm-3 huanhang" style="text-align: right;margin: 10px 0px;">版本号:</label>
+            <div class="formControls col-xs-9 col-sm-9 skin-minimal huanhang" style="margin: 10px 0px;">
+                <input class="my-input" style="width: 90%;" type="text" value="${detectInfo.detectVersionNumber!''}" name="detectVersionNumber" id="detectVersionNumber"  placeholder="请输入版本号"/>
+            </div>
+        </div>
        <div class="input-box" >
             <label class="col-3 col-sm-3 huanhang" style="text-align: right;margin: 10px 0px;">检测现象:</label>
             <div class="formControls col-xs-9 col-sm-9 skin-minimal huanhang" style="margin: 10px 0px;">
@@ -100,14 +157,14 @@
                 <input class="my-input" style="width: 90%;" type="text" value="${detectInfo.detectNalysis!''}" name="detectNalysis" id="detectNalysis"  placeholder="请输入原因分析"/>
             </div>
         </div>
-        <div class="input-box">
+    <#--    <div class="input-box">
             <label class="col-3 col-sm-3 huanhang" style="text-align: right;margin: 10px 0px;">检测内容:</label>
             <div class="formControls col-xs-9 col-sm-9 skin-minimal huanhang" style="margin: 10px 0px;">
-                <#--<textarea style="margin-left: 0%;width: 83%;" rows="2" cols="20" name="detectContent" id="detectContent" class="my-textarea" placeholder="请输入检测内容">${detectInfo.detectContent!''}</textarea>-->
+                &lt;#&ndash;<textarea style="margin-left: 0%;width: 83%;" rows="2" cols="20" name="detectContent" id="detectContent" class="my-textarea" placeholder="请输入检测内容">${detectInfo.detectContent!''}</textarea>&ndash;&gt;
                 <input class="my-input" style="width: 90%;" type="text" value="${detectInfo.detectContent!''}" name="detectContent" id="detectContent"  placeholder="请输入检测内容"/>
 
             </div>
-        </div>
+        </div>-->
         <div class="input-box">
             <label class="form-label col-3 col-sm-3 huanhang" style="text-align: right;margin: 10px 0px;">维修报价:</label>
             <div class="formControls col-9 col-sm-9 text-c huanhang" style="margin-left: -4%;margin: 10px 0px 10px -14px;">

+ 22 - 10
watero-rst-web/src/main/webapp/WEB-INF/views/cm/inventory/inventoryLog_list.ftl

@@ -52,10 +52,10 @@
         </select>
              <select class="my-select" name="logOperationType" style="height: 30px;width: 150px">
              <option value ="">选择操作类型</option>
-             <option value ="1" <#if logOperationType??><#if logOperationType == 1>selected="selected"</#if></#if>>增加</option>
-             <option value ="2" <#if logOperationType??><#if logOperationType == 2>selected="selected"</#if></#if>>减少</option>
+             <option value ="1" <#if logOperationType??><#if logOperationType == 1>selected="selected"</#if></#if>>入库</option>
+             <option value ="2" <#if logOperationType??><#if logOperationType == 2>selected="selected"</#if></#if>>出库</option>
         </select>
-        <select id="logWarehouseId" name="logWarehouseId" class="select" style="width: 120px;">
+        <#--<select id="logWarehouseId" name="logWarehouseId" class="select" style="width: 120px;">
         <#if (warehouseList?size > 0)>
             <#list warehouseList as info>
                 <#if logWarehouseId??>
@@ -65,7 +65,8 @@
                 </#if>
             </#list>
         </#if>
-        </select>
+        </select>-->
+            <input type="hidden" value="${logProductBar!''}" name="logProductBar">
         <button style="cursor:pointer;" type="submit" class="my-btn-search">搜索</button>
         </form>
     </div>
@@ -75,9 +76,10 @@
             <tr class="text-c">
                 <th width="100">产品名称</th>
                 <th width="100">产品sku</th>
-                <th width="100">仓库名称</th>
+                <#--<th width="100">仓库名称</th>-->
                 <th width="100">变动数量</th>
                 <th width="100">类型</th>
+                <th width="100">质量类型</th>
                 <th width="100">操作类型</th>
                 <th width="100">备注</th>
             </tr>
@@ -88,7 +90,7 @@
                 <tr>
                     <td class="text-c" width="100">${info.logProductName!}</td>
                     <td class="text-c" width="100">${info.logProductBar!}</td>
-                    <td class="text-c" width="100">${info.logWarehouseName!}</td>
+                    <#--<td class="text-c" width="100">${info.logWarehouseName!}</td>-->
                     <td class="text-c" width="100">${info.logRemainingNum!}</td>
                     <td class="text-c" width="100">
                         <#if info.logType == 1>
@@ -102,11 +104,21 @@
                         </#if>
                     </td>
                     <td class="text-c" width="100">
-                        <#if info.logType == 1>
-                            增加
+                        <#if info.logOperationType == 1>
+                            入库
                         </#if>
-                        <#if info.logType == 2>
-                            减少
+                        <#if info.logOperationType == 2>
+                            出库
+                        </#if>
+                    </td>
+                    <td class="text-c" width="100">
+                        <#if info.logQualityType??>
+                            <#if info.logQualityType == 1>
+                                良品
+                            </#if>
+                            <#if info.logQualityType == 2>
+                                不良品
+                            </#if>
                         </#if>
                     </td>
                     <td class="text-c" width="100">${info.logDesc!}</td>

+ 50 - 34
watero-rst-web/src/main/webapp/WEB-INF/views/cm/inventory/inventory_list.ftl

@@ -40,9 +40,9 @@
 <div class="page-container">
     <div class="text-c">
         <form name="form1" action="${path}/admin/inventory/select_inventory_list" method="post">
-            <select id="inventoryProductBar" name="inventoryProductBar" class="select" style="width: 120px;">
-            <#if (productList?size > 0)>
-                <#list productList as product>
+            <#--<select id="inventoryProductBar" name="inventoryProductBar" class="select" style="width: 120px;">
+            <#if (productColorList?size > 0)>
+                <#list productColorList as product>
                     <#if inventoryProductBar??>
                         <option value="${product.colorBar!""}" <#if product.colorBar == inventoryProductBar>selected</#if>>${product.productName!""}</option>
                     <#else >
@@ -54,7 +54,18 @@
 
             <select id="productColorId" name="productColorId" class="select" style="width: 120px;">
 
-            </select>
+            </select>-->
+            <select class="my-select" name="productTypeId" style="height: 30px;width: 150px">
+                    <option value ="">选择产品类型</option>
+                <#if (productTypeList?size > 0)>
+                    <#list productTypeList as typeList>
+                        <option value ="${typeList.typeId!}" <#if productTypeId??><#if productTypeId == typeList.typeId>selected="selected"</#if></#if>>${typeList.typeName!}</option>
+                    </#list>
+                </#if>
+             </select>
+                <input class="my-input" style="width: 100px;height: 29px;" type="text" name="inventoryProductName" value="${inventoryProductName!}" placeholder="产品名称"/>
+                <input class="my-input" style="width: 100px;height: 29px;" type="text" name="productColorName" value="${productColorName!}" placeholder="产品颜色"/>
+                <input class="my-input" style="width: 100px;height: 29px;" type="text" name="inventoryProductBar" value="${inventoryProductBar!}" placeholder="产品69码"/>
             <button style="cursor:pointer;" type="submit" class="my-btn-search">搜索</button>
         </form>
     </div>
@@ -62,45 +73,52 @@
         <table class="table table-border table-bordered table-bg table-hover table-sort">
             <thead>
             <tr class="text-c">
+                <th width="100">产品类型</th>
                 <th width="100">产品名称</th>
-                <th width="160">产品sku</th>
-                <th width="120">库存剩余数量</th>
-                <th width="120">状态</th>
-                <th width="200">备注</th>
-                <th width="50">操作</th>
+                <#--<th width="100">产品型号</th>-->
+                <th width="100">产品简称</th>
+                <th width="100">产品颜色</th>
+                <th width="100">产品69码</th>
+                <th width="100">待发数量</th>
+                <th width="100">良品数量</th>
+                <th width="100">不良品数量</th>
+                <th width="100">最近记录</th>
+                <th width="100">操作</th>
             </tr>
             </thead>
             <tbody id="listid">
             <#if (page.dataList?size > 0)>
                 <#list page.dataList as info>
                 <tr>
+                    <td class="text-c" width="100">${info.productTypeName!}</td>
                     <td class="text-c" width="100">${info.inventoryProductName!}</td>
+                    <#--<td class="text-c" width="100">${info.productNumber!}</td>-->
+                    <td class="text-c" width="100">${info.productAbbreviation!}</td>
+                    <td class="text-c" width="100">${info.productColorName!}</td>
                     <td class="text-c" width="100">${info.inventoryProductBar!}</td>
-                    <td class="text-c" width="100">${info.inventoryRemainingNum!}</td>
-                    <td class="text-c" width="100">
-                    <#if info.inventoryState == 1>
-                        正在使用
-                    </#if>
-                    <#if info.inventoryState == 2>
-                        暂停使用
-                    </#if>
-                    </td>
-                    <td class="text-c" width="100">${info.inventoryDesc!}</td>
+                    <td class="text-c" width="100">${info.inventoryMomentumNum!}</td>
+                    <td class="text-c" width="100">${info.inventoryGoodProductNum!}</td>
+                    <td class="text-c" width="100">${info.inventoryDefectiveProductNum!}</td>
+                    <td class="text-c" width="100">${info.inventoryRecentRecord!}</td>
                     <!-- 遍历操作 -->
                     <td class="td-manage text-c">
                         <a style="text-decoration:none" href="javascript:;" title="增加库存"
-                           onclick="add_remark('增加库存','${path}/admin/inventory/to_update_inventory?inventoryId=${info.inventoryId!''}','570','450');">
-                            <i class="Hui-iconfont">&#xe600;</i>
+                           onclick="update('增加库存','${path}/admin/inventory/to_update_inventory?inventoryId=${info.inventoryId!''}&operationType=2','570','450');">
+                            <i class="Hui-iconfont">入库</i>
                         </a>
                         <a style="text-decoration:none" href="javascript:;" title="减少库存"
-                           onclick="add_remark('减少库存','${path}/admin/inventory/to_update_inventory?inventoryId=${info.inventoryId!''}','570','450');">
-                            <i class="Hui-iconfont">&#xe6a1;</i>
+                           onclick="update('减少库存','${path}/admin/inventory/to_update_inventory?inventoryId=${info.inventoryId!''}&operationType=1','570','450');">
+                            <i class="Hui-iconfont">出库</i>
+                        </a>
+                        <a style="text-decoration:none" href="javascript:;" title="出入库记录"
+                           onclick="getInventoryLog('${path}/admin/inventory/select_inventoryLog_list?logProductBar=${info.inventoryProductBar!''}');">
+                            <i class="Hui-iconfont">出入库记录</i>
                         </a>
                     </td>
                 </tr>
                 </#list>
             <#else >
-            <tr><td class="td-manage text-c" colspan = "6">暂时没有库存信息</td></tr>
+            <tr><td class="td-manage text-c" colspan = "11">暂时没有库存信息</td></tr>
             </#if>
             </tbody>
         </table>
@@ -110,17 +128,15 @@
 <#include "/base/page_util.ftl">
 <script type="text/javascript" src="${path}/common/lib/jquery.PrintArea/jquery.PrintArea.js"></script>
 <script type="text/javascript">
-    /**
-     * 进入查询问题描述信息页面
-     */
-    function getDescribeInfo(customerId) {
-        layer_show("问题描述","${path}/admin/customer/_question_describe?customerId="+customerId,"800","500");
-    }
-    /*转入品检*/
-    function into_complaint(title,url,w,h){
+    /*修改*/
+    function update(title,url,w,h){
         layer_show(title,url,w,h);
     }
-    $(function(){
+    function getInventoryLog(url) {
+        location.href = url;
+    }
+
+    /*$(function(){
         getProduct($("#productId").children('option:selected').val())
     });
     //查询产品颜色信息
@@ -153,7 +169,7 @@
                 layer.msg('添加错误',{icon: 5,time:1000});
             }
         });
-    }
+    }*/
 </script>
 </body>
 </html>

+ 143 - 0
watero-rst-web/src/main/webapp/WEB-INF/views/cm/inventory/update_inventory.ftl

@@ -0,0 +1,143 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+    <meta charset="utf-8">
+    <meta name="renderer" content="webkit|ie-comp|ie-stand">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
+    <meta http-equiv="Cache-Control" content="no-siteapp" />
+<#include "/base/add_base.ftl">
+    <title>修改库存数量</title>
+    <style>
+        .my-title{font-weight: 500;padding-left: 15px;position: relative;}
+        .my-title:after{content: '';position: absolute;left: 0;top:12%;width: 3px;height: 80%;background: #32a3d8;}
+        .my-input{padding: 8px 5px;width: 80%;border:1px solid rgba(0,0,0,.1);}
+        .my-input-date{padding: 8px 10px;border:1px solid rgba(0,0,0,.1);width: 80%;background: url(http://s.iamberry.com/images/rili-1.png) 98.5% center no-repeat; background-size:auto 50%;}
+        .input-box{margin: 18px 0;}
+        .input-dic{float: left;margin:5px 10px 0 0;font-size: 12px;}
+        .add-list{list-style-type: none;padding: 10px;background-color: #f5f5f5;width: 60%;float: left;margin: 0;}
+        .add-list>li{margin: 10px 0;}
+        .my-textarea{padding: 5px 10px;width: 80%;border:1px solid rgba(0,0,0,.1);}
+        .my-btn-reset{padding: 10px 20px;width: 150px; background-color: #fff;color: #32a3d8;border: 1px solid #32a3d8;cursor:pointer;margin: 10px 10px 0 10px;}
+        .my-btn-submit{padding: 10px 20px;width: 150px; background-color: #32a3d8;color: #fff;border: 1px solid #32a3d8;cursor:pointer;margin: 10px 10px 0 10px;}
+        .my-select{border: 1px solid rgba(0,0,0,.1);padding:6px 50px 6px 15px;height: 34px; -webkit-appearance:none;appearance:none;background: url(/common/images/pts/select-11.png) right center no-repeat;background-size:auto 100%;}
+        input[type=radio]{-webkit-appearance:none;appearance:none;background: url(/common/images/pts/radio-1.png) center center no-repeat;background-size:auto 100%;width: 20px;height: 20px;margin-right: 10px;}
+        input[type=radio]:checked{-webkit-appearance:none;appearance:none;background: url(/common/images/pts/radio-2.png) center center no-repeat;background-size:auto 100%;width: 20px;height: 20px;margin-right: 10px;}
+    </style>
+    <meta name="keywords" content="${path}">
+    <meta name="description" content="H-ui.admin v3.0,是一款由国人开发的轻量级扁平化网站后台模板,完全免费开源的网站后台管理系统模版,适合中小型CMS后台系统。">
+</head>
+<body>
+<article class="page-container">
+    <form class="form form-horizontal" id="form-admin-add">
+        <div class="row cl">
+            <div class="formControls col-12 col-sm-12">
+                <strong>寄回状态</strong>
+                <div class="radio-box">
+                    <input type="radio" id="tel-b1" name="operationType" value="1" <#if operationType == 1>checked</#if>>
+                    <label for="tel-b1">出库</label>
+                </div>
+                <div class="radio-box">
+                    <input type="radio" id="tel-b2" name="operationType" value="2" <#if operationType == 2>checked</#if>>
+                    <label for="tel-b2">入库</label>
+                </div>
+            </div>
+        </div>
+        <div class="row cl">
+            <div class="formControls col-12 col-sm-12">
+                <strong>质量类型</strong>
+                <div class="radio-box">
+                    <input type="radio" id="tel-b1" name="qualityType" checked value="1">
+                    <label for="tel-b1">良品</label>
+                </div>
+                <div class="radio-box">
+                    <input type="radio" id="tel-b2" name="qualityType" value="2">
+                    <label for="tel-b2">不良品</label>
+                </div>
+            </div>
+        </div>
+        <div class="row cl">
+            <div class="formControls col-12 col-sm-12">
+                <strong>操作产品</strong>
+                <div class="radio-box">
+                    <span>${inventoryInfo.inventoryProductName!''}(${inventoryInfo.productColorName!''})</span><br>
+                </div>
+            </div>
+        </div>
+        <div class="row cl">
+            <div class="formControls col-12 col-sm-12">
+                <strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</strong>
+                <div class="radio-box" style="color: #6d6d72;">
+                    <span id="inventoryGoodProductNumId">良品库存剩余:${inventoryInfo.inventoryGoodProductNum!''}</span>&nbsp;&nbsp;&nbsp;
+                    <span id="inventoryDefectiveProductNumId">不良品库存剩余:${inventoryInfo.inventoryDefectiveProductNum!''}</span>
+                </div>
+            </div>
+        </div>
+        <div class="row cl" style="position: relative;" >
+            <div class="formControls col-12 col-sm-12">
+                <strong>操作数量</strong>
+                <div class="radio-box">
+                    <input type="text" style="width: 244px;" class="input-text" value="" placeholder="请输入本次入库、出库数量" id="operationNum" name="operationNum">
+                </div>
+            </div>
+        </div>
+        <div class="row cl">
+            <div class="formControls col-12 col-sm-12">
+                <strong>操作备注</strong>
+                <div class="radio-box">
+                    <textarea type="text" placeholder="" id="inventoryDesc" name="inventoryDesc" style="width: 244px;height: 80px;"></textarea>
+                </div>
+            </div>
+        </div>
+        <input type="hidden" value="${inventoryInfo.inventoryId!''}" id="inventoryId" name="inventoryId">
+
+        <div style="text-align:center;" >
+            <button type="button" class="my-btn-submit" onclick="update();">确认提交</button>
+        </div>
+
+    </form>
+</article>
+<script type="text/javascript" src="${path}/common/lib/My97DatePicker/4.8/WdatePicker.js"></script>
+<script type="text/javascript">
+
+    /**
+     * 修改库存
+     */
+    function update(){
+        var operationType = parseInt($("input[name='operationType']:checked").val());
+        var qualityType = parseInt($("input[name='qualityType']:checked").val());
+        var operationNum = cufte($("#operationNum").val());
+        var inventoryDesc = cufte($("#inventoryDesc").val());
+        var inventoryId = cufte($("#inventoryId").val());
+        $.ajax('${path}/admin/inventory/update_num?dates=' + new Date().getTime(), {
+            data: {
+                "operationType":operationType,
+                "qualityType":qualityType,
+                "operationNum" : operationNum,
+                "inventoryDesc" : inventoryDesc,
+                "inventoryId" : inventoryId
+            },
+            dataType: 'json',
+            type: 'post',
+            timeout: 15000,
+            success: function(dt) {
+                if (dt.returnCode === 200) {
+                    layer.msg('操作成功',{icon: 1,time:1000},function () {
+                        window.parent.location.reload();
+                        var index = parent.layer.getFrameIndex(window.name);
+                        parent.layer.close(index)
+                    });
+                }else if(dt.returnCode === 502){
+                    layer.msg('剩余库存不足',{icon: 5,time:1000});
+                }
+
+            },
+            error: function(xhr, type, errorThrown) {
+                layer.msg("操作失败,请重试!", {icon: 5, time: 3000});
+            }
+        });
+    }
+
+</script>
+</body>
+</html>