From a36f6d72f72d26ef0dd6e13f9af554787924e8d6 Mon Sep 17 00:00:00 2001
From: chen.lin <1442464845@qq.com>
Date: 星期二, 27 一月 2026 18:58:13 +0800
Subject: [PATCH] 生成领料单-pda+后台

---
 src/main/java/materialReceive.sql                                      |   42 +
 src/main/java/com/zy/asrs/mapper/MaterialReceiveMapper.java            |   12 
 src/main/resources/mapper/MaterialReceiveMapper.xml                    |   37 +
 src/main/java/com/zy/asrs/controller/MaterialReceiveController.java    |  404 ++++++++++++++
 src/main/webapp/views/materialReceive/materialReceive.html             |  359 +++++++++++++
 src/main/java/com/zy/asrs/service/impl/MaterialReceiveServiceImpl.java |   12 
 src/main/java/com/zy/asrs/service/MaterialReceiveService.java          |    8 
 src/main/java/com/zy/asrs/entity/MaterialReceive.java                  |  255 +++++++++
 src/main/webapp/views/pda/materialReceiveOut.html                      |  489 ++++++++++++++++++
 9 files changed, 1,618 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/MaterialReceiveController.java b/src/main/java/com/zy/asrs/controller/MaterialReceiveController.java
new file mode 100644
index 0000000..c2bc2b2
--- /dev/null
+++ b/src/main/java/com/zy/asrs/controller/MaterialReceiveController.java
@@ -0,0 +1,404 @@
+package com.zy.asrs.controller;
+
+import com.baomidou.mybatisplus.annotations.TableField;
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.baomidou.mybatisplus.plugins.Page;
+import com.core.common.Cools;
+import com.core.common.R;
+import com.core.annotations.ManagerAuth;
+import com.zy.asrs.entity.MaterialReceive;
+import com.zy.asrs.service.MaterialReceiveService;
+import com.zy.common.web.BaseController;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import com.core.common.DateUtils;
+import java.lang.reflect.Field;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+public class MaterialReceiveController extends BaseController {
+
+    @Autowired
+    private MaterialReceiveService materialReceiveService;
+
+    @RequestMapping(value = "/materialReceive/{id}/auth")
+    @ManagerAuth
+    public R get(@PathVariable("id") String id) {
+        return R.ok(materialReceiveService.selectById(String.valueOf(id)));
+    }
+
+    @RequestMapping(value = "/materialReceive/list/auth")
+    @ManagerAuth
+    public R list(@RequestParam(defaultValue = "1") Integer curr,
+                  @RequestParam(defaultValue = "1000") Integer limit,
+                  @RequestParam(required = false) String orderByField,
+                  @RequestParam(required = false) String orderByType,
+                  @RequestParam(required = false) String condition,
+                  @RequestParam(required = false) Boolean pdaQuery,
+                  @RequestParam Map<String, Object> param) {
+        EntityWrapper<MaterialReceive> wrapper = new EntityWrapper<>();
+        excludeTrash(param);
+        // 绉婚櫎pdaQuery鍙傛暟锛屽洜涓哄畠涓嶆槸鏁版嵁搴撳瓧娈碉紝鍙槸鎺у埗鍙傛暟
+        param.remove("pdaQuery");
+        convert(param, wrapper);
+        allLike(MaterialReceive.class, param.keySet(), wrapper, condition);
+        
+        // 鍙傝�冨叾浠栧嚭搴撴ā鍧楋紝PDA鍑哄簱鏌ヨ鏃惰繃婊ゆ帀宸插叏閮ㄥ嚭搴撶殑鐗╂枡锛堝彧鏄剧ず杩樻湁鍓╀綑鏁伴噺鐨勶級
+        // 閫氳繃 pdaQuery 鍙傛暟鍒ゆ柇鏄惁鏄疨DA鍑哄簱鏌ヨ
+        if (pdaQuery != null && pdaQuery) {
+            // PDA鍑哄簱鏌ヨ锛氬彧鏄剧ず鍓╀綑鏁伴噺澶т簬0鐨勮褰�
+            wrapper.gt("remain_qty", 0);
+        }
+        
+        if (!Cools.isEmpty(orderByField)) {
+            wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));
+        }
+        return R.ok(materialReceiveService.selectPage(new Page<>(curr, limit), wrapper));
+    }
+
+    @RequestMapping(value = "/materialReceive/batchSave/auth", method = RequestMethod.POST)
+    @ManagerAuth
+    public R batchSave(@RequestBody List<Map<String, Object>> dataList) {
+        if (Cools.isEmpty(dataList)) {
+            return R.error("鏁版嵁涓嶈兘涓虹┖");
+        }
+        int successCount = 0;
+        int updateCount = 0;
+        for (Map<String, Object> data : dataList) {
+            try {
+                // 妫�鏌ユ槸鍚﹀凡瀛樺湪锛堟牴鎹畇oCode鍜宨nvCode鍜宖interid鍞竴鏍囪瘑锛�
+                String soCode = data.get("soCode") != null ? String.valueOf(data.get("soCode")) : null;
+                String invCode = data.get("invCode") != null ? String.valueOf(data.get("invCode")) : null;
+                Integer finterid = null;
+                if (data.get("finterid") != null) {
+                    try {
+                        finterid = Integer.valueOf(String.valueOf(data.get("finterid")));
+                    } catch (Exception e) {
+                        // 蹇界暐杞崲閿欒
+                    }
+                }
+
+                MaterialReceive existRecord = null;
+                if (soCode != null && invCode != null && finterid != null) {
+                    existRecord = materialReceiveService.selectOne(new EntityWrapper<MaterialReceive>()
+                            .eq("so_code", soCode)
+                            .eq("inv_code", invCode)
+                            .eq("finterid", finterid));
+                }
+
+                MaterialReceive materialReceive;
+                if (existRecord != null) {
+                    // 宸插瓨鍦紝鏇存柊鏁版嵁锛堜笉瑕嗙洊鍑哄簱鐩稿叧瀛楁锛�
+                    materialReceive = existRecord;
+                    updateCount++;
+                } else {
+                    // 涓嶅瓨鍦紝鍒涘缓鏂拌褰�
+                    materialReceive = new MaterialReceive();
+                    materialReceive.setCreateTime(new Date());
+                    // 鍒濆鍖栧嚭搴撶浉鍏冲瓧娈�
+                    materialReceive.setOutQty(BigDecimal.ZERO);
+                    materialReceive.setRemainQty(data.get("qty") != null ? 
+                        new BigDecimal(String.valueOf(data.get("qty"))) : BigDecimal.ZERO);
+                    materialReceive.setIsAllOut(0);
+                    successCount++;
+                }
+
+                // 鏇存柊/璁剧疆瀛楁
+                materialReceive.setSoCode(soCode);
+                materialReceive.setFbillno(data.get("fbillno") != null ? String.valueOf(data.get("fbillno")) : null);
+                materialReceive.setInvCode(invCode);
+                materialReceive.setInvName(data.get("invName") != null ? String.valueOf(data.get("invName")) : null);
+                materialReceive.setInvStd(data.get("invStd") != null ? String.valueOf(data.get("invStd")) : null);
+                
+                // 鏁伴噺瀛楁澶勭悊锛堜紭鍏堜娇鐢╢qty锛屽鏋滄病鏈夊垯浣跨敤qty锛�
+                BigDecimal qty = null;
+                if (data.get("fqty") != null) {
+                    qty = new BigDecimal(String.valueOf(data.get("fqty")));
+                    materialReceive.setFqty(qty);
+                } else if (data.get("qty") != null) {
+                    qty = new BigDecimal(String.valueOf(data.get("qty")));
+                    materialReceive.setQty(qty);
+                }
+                
+                if (data.get("fauxqty") != null) {
+                    materialReceive.setFauxqty(new BigDecimal(String.valueOf(data.get("fauxqty"))));
+                }
+                
+                // 濡傛灉宸插瓨鍦紝鏇存柊鍓╀綑鏁伴噺锛堝熀浜庡師濮嬫暟閲忥級
+                if (existRecord == null && qty != null) {
+                    materialReceive.setRemainQty(qty);
+                } else if (existRecord != null && qty != null) {
+                    // 宸插瓨鍦ㄦ椂锛屽鏋滄暟閲忔湁鍙樺寲锛岄噸鏂拌绠楀墿浣欐暟閲�
+                    BigDecimal originalQty = existRecord.getFqty() != null ? existRecord.getFqty() : 
+                                           (existRecord.getQty() != null ? existRecord.getQty() : BigDecimal.ZERO);
+                    BigDecimal outQty = existRecord.getOutQty() != null ? existRecord.getOutQty() : BigDecimal.ZERO;
+                    // 濡傛灉鏂版暟閲忎笌鍘熷鏁伴噺涓嶅悓锛岃鏄庢暟閲忔洿鏂颁簡锛岄渶瑕侀噸鏂拌绠楀墿浣欐暟閲�
+                    if (qty.compareTo(originalQty) != 0) {
+                        // 鏁伴噺鍙樺寲锛屽墿浣欐暟閲� = 鏂版暟閲� - 宸插嚭搴撴暟閲�
+                        materialReceive.setRemainQty(qty.subtract(outQty));
+                    } else {
+                        // 鏁伴噺娌″彉鍖栵紝淇濇寔鍘熸湁鍓╀綑鏁伴噺
+                        materialReceive.setRemainQty(existRecord.getRemainQty());
+                    }
+                }
+                
+                materialReceive.setUnit(data.get("unit") != null ? String.valueOf(data.get("unit")) : null);
+                materialReceive.setDepName(data.get("depName") != null ? String.valueOf(data.get("depName")) : null);
+                materialReceive.setDepCode(data.get("depCode") != null ? String.valueOf(data.get("depCode")) : null);
+                if (data.get("depId") != null) {
+                    try {
+                        materialReceive.setDepId(Integer.valueOf(String.valueOf(data.get("depId"))));
+                    } catch (Exception e) {
+                        // 蹇界暐杞崲閿欒
+                    }
+                }
+                if (data.get("fworkshop") != null) {
+                    try {
+                        materialReceive.setFworkshop(Integer.valueOf(String.valueOf(data.get("fworkshop"))));
+                    } catch (Exception e) {
+                        // 蹇界暐杞崲閿欒
+                    }
+                }
+                if (data.get("whId") != null) {
+                    try {
+                        materialReceive.setWhId(Integer.valueOf(String.valueOf(data.get("whId"))));
+                    } catch (Exception e) {
+                        // 蹇界暐杞崲閿欒
+                    }
+                }
+                materialReceive.setWhName(data.get("whName") != null ? String.valueOf(data.get("whName")) : null);
+                if (data.get("fplancommitdate") != null && !Cools.isEmpty(String.valueOf(data.get("fplancommitdate")))) {
+                    try {
+                        String dateStr = String.valueOf(data.get("fplancommitdate"));
+                        java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd");
+                        materialReceive.setFplancommitdate(sdf.parse(dateStr));
+                    } catch (Exception ex) {
+                        // 蹇界暐鏃ユ湡瑙f瀽閿欒
+                    }
+                }
+                if (data.get("fplanfinishdate") != null && !Cools.isEmpty(String.valueOf(data.get("fplanfinishdate")))) {
+                    try {
+                        String dateStr = String.valueOf(data.get("fplanfinishdate"));
+                        java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd");
+                        materialReceive.setFplanfinishdate(sdf.parse(dateStr));
+                    } catch (Exception ex) {
+                        // 蹇界暐鏃ユ湡瑙f瀽閿欒
+                    }
+                }
+                if (finterid != null) {
+                    materialReceive.setFinterid(finterid);
+                }
+                if (data.get("fitemid") != null) {
+                    try {
+                        materialReceive.setFitemid(Integer.valueOf(String.valueOf(data.get("fitemid"))));
+                    } catch (Exception e) {
+                        // 蹇界暐杞崲閿欒
+                    }
+                }
+                if (data.get("funitid") != null) {
+                    try {
+                        materialReceive.setFunitid(Integer.valueOf(String.valueOf(data.get("funitid"))));
+                    } catch (Exception e) {
+                        // 蹇界暐杞崲閿欒
+                    }
+                }
+                
+                // 灏嗗叾浠栧瓧娈靛瓨鍌ㄥ埌ext_data锛圝SON鏍煎紡锛夛紝鐢ㄤ簬鏍¢獙鐢熶骇棰嗘枡鍑哄簱鏁伴噺
+                Map<String, Object> extDataMap = new HashMap<>();
+                // 宸叉槧灏勫埌鏁版嵁搴撹〃瀛楁鐨勫瓧娈靛垪琛紙杩欎簺瀛楁涓嶉渶瑕佸瓨鍌ㄥ湪ext_data涓級
+                java.util.Set<String> mappedFields = new java.util.HashSet<>();
+                mappedFields.add("soCode");
+                mappedFields.add("fbillno");
+                mappedFields.add("invCode");
+                mappedFields.add("invName");
+                mappedFields.add("invStd");
+                mappedFields.add("qty");
+                mappedFields.add("fqty");
+                mappedFields.add("fauxqty");
+                mappedFields.add("unit");
+                mappedFields.add("depName");
+                mappedFields.add("depCode");
+                mappedFields.add("depId");
+                mappedFields.add("fworkshop");
+                mappedFields.add("whId");
+                mappedFields.add("whName");
+                mappedFields.add("fplancommitdate");
+                mappedFields.add("fplanfinishdate");
+                mappedFields.add("finterid");
+                mappedFields.add("fitemid");
+                mappedFields.add("funitid");
+                
+                // 灏嗘墍鏈夋湭鏄犲皠鐨勫瓧娈靛瓨鍌ㄥ埌ext_data涓紙鍖呭惈鎵�鏈夋墦鍗伴瑙堝拰鎵撳嵃鐩稿叧鐨勫瓧娈碉級
+                for (Map.Entry<String, Object> entry : data.entrySet()) {
+                    String key = entry.getKey();
+                    if (!mappedFields.contains(key) && entry.getValue() != null) {
+                        extDataMap.put(key, entry.getValue());
+                    }
+                }
+                
+                // 濮嬬粓鏇存柊ext_data锛屽嵆浣夸负绌轰篃瑕佸瓨鍌紙鐢ㄤ簬鍚庣画鎵╁睍锛�
+                materialReceive.setExtData(com.alibaba.fastjson.JSON.toJSONString(extDataMap));
+                
+                materialReceive.setSyncTime(new Date());
+                materialReceive.setUpdateTime(new Date());
+
+                // 淇濆瓨鎴栨洿鏂�
+                if (existRecord != null) {
+                    materialReceiveService.updateById(materialReceive);
+                } else {
+                    materialReceiveService.insert(materialReceive);
+                }
+            } catch (Exception e) {
+                // 璁板綍澶辫触鐨勮褰曪紝缁х画澶勭悊涓嬩竴鏉�
+                e.printStackTrace();
+            }
+        }
+        return R.ok("鎴愬姛淇濆瓨 " + successCount + " 鏉℃柊鏁版嵁锛屾洿鏂� " + updateCount + " 鏉″凡瀛樺湪鏁版嵁");
+    }
+
+    @RequestMapping(value = "/materialReceive/update/auth")
+    @ManagerAuth
+    public R update(MaterialReceive materialReceive) {
+        if (Cools.isEmpty(materialReceive) || null == materialReceive.getId()) {
+            return R.error();
+        }
+        materialReceive.setUpdateTime(new Date());
+        materialReceiveService.updateById(materialReceive);
+        return R.ok();
+    }
+
+    @RequestMapping(value = "/materialReceive/updateOutQty/auth", method = RequestMethod.POST)
+    @ManagerAuth
+    public R updateOutQty(@RequestBody Map<String, Object> param) {
+        Long id = Long.valueOf(String.valueOf(param.get("id")));
+        BigDecimal addOutQty = new BigDecimal(String.valueOf(param.get("outQty"))); // 鏈鍑哄簱鏁伴噺
+        
+        MaterialReceive materialReceive = materialReceiveService.selectById(id);
+        if (materialReceive == null) {
+            return R.error("璁板綍涓嶅瓨鍦�");
+        }
+        
+        // 绱姞鍑哄簱鏁伴噺
+        BigDecimal currentOutQty = materialReceive.getOutQty() != null ? materialReceive.getOutQty() : BigDecimal.ZERO;
+        BigDecimal newOutQty = currentOutQty.add(addOutQty);
+        materialReceive.setOutQty(newOutQty);
+        
+        // 璁$畻鍓╀綑鏁伴噺锛堜紭鍏堜娇鐢╢qty锛屽鏋滄病鏈夊垯浣跨敤qty锛�
+        BigDecimal qty = materialReceive.getFqty() != null ? materialReceive.getFqty() : 
+                         (materialReceive.getQty() != null ? materialReceive.getQty() : BigDecimal.ZERO);
+        BigDecimal remainQty = qty.subtract(newOutQty);
+        materialReceive.setRemainQty(remainQty.compareTo(BigDecimal.ZERO) > 0 ? remainQty : BigDecimal.ZERO);
+        
+        // 鍒ゆ柇鏄惁鍏ㄩ儴鍑哄簱瀹屾垚
+        materialReceive.setIsAllOut(remainQty.compareTo(BigDecimal.ZERO) <= 0 ? 1 : 0);
+        materialReceive.setUpdateTime(new Date());
+        
+        materialReceiveService.updateById(materialReceive);
+        return R.ok();
+    }
+
+    @RequestMapping(value = "/materialReceive/checkSyncStatus/auth")
+    @ManagerAuth
+    public R checkSyncStatus(@RequestParam String soCode, @RequestParam(required = false) String invCode) {
+        EntityWrapper<MaterialReceive> wrapper = new EntityWrapper<>();
+        wrapper.eq("so_code", soCode);
+        if (!Cools.isEmpty(invCode)) {
+            wrapper.eq("inv_code", invCode);
+        }
+        List<MaterialReceive> list = materialReceiveService.selectList(wrapper);
+        
+        Map<String, Object> result = new HashMap<>();
+        if (Cools.isEmpty(list)) {
+            result.put("synced", false);
+            result.put("allOut", false);
+            result.put("message", "璇ョ敓浜у崟鍙锋湭鍚屾鍒癢MS");
+            return R.ok(result);
+        }
+        
+        // 妫�鏌ユ槸鍚﹀叏閮ㄥ嚭搴撳畬鎴�
+        boolean allOut = true;
+        List<Map<String, Object>> notOutList = new ArrayList<>();
+        for (MaterialReceive mr : list) {
+            if (mr.getIsAllOut() == null || mr.getIsAllOut() != 1) {
+                allOut = false;
+                Map<String, Object> notOutItem = new HashMap<>();
+                notOutItem.put("invCode", mr.getInvCode());
+                notOutItem.put("invName", mr.getInvName());
+                notOutItem.put("remainQty", mr.getRemainQty());
+                notOutList.add(notOutItem);
+            }
+        }
+        
+        result.put("synced", true);
+        result.put("allOut", allOut);
+        result.put("records", list);
+        if (!allOut && !notOutList.isEmpty()) {
+            result.put("notOutList", notOutList);
+            result.put("message", "閮ㄥ垎鐗╂枡鏈叏閮ㄥ嚭搴撳畬鎴�");
+        } else if (allOut) {
+            result.put("message", "鍏ㄩ儴鐗╂枡宸插嚭搴撳畬鎴�");
+        }
+        return R.ok(result);
+    }
+    
+    private void convert(Map<String, Object> map, EntityWrapper<MaterialReceive> wrapper) {
+        for (Map.Entry<String, Object> entry : map.entrySet()) {
+            String fieldName = entry.getKey();
+            String columnName = getColumnName(MaterialReceive.class, fieldName);
+            String val = String.valueOf(entry.getValue());
+            if (val.contains(RANGE_TIME_LINK)) {
+                String[] dates = val.split(RANGE_TIME_LINK);
+                wrapper.ge(columnName, DateUtils.convert(dates[0]));
+                wrapper.le(columnName, DateUtils.convert(dates[1]));
+            } else {
+                wrapper.like(columnName, val);
+            }
+        }
+    }
+    
+    /**
+     * 鏍规嵁瀹炰綋绫诲瓧娈靛悕鑾峰彇鏁版嵁搴撳垪鍚�
+     * @param cls 瀹炰綋绫�
+     * @param fieldName Java瀛楁鍚嶏紙椹煎嘲鍛藉悕锛�
+     * @return 鏁版嵁搴撳垪鍚嶏紙涓嬪垝绾垮懡鍚嶏級
+     */
+    private String getColumnName(Class<?> cls, String fieldName) {
+        for (Field field : Cools.getAllFields(cls)) {
+            if (field.getName().equals(fieldName)) {
+                if (field.isAnnotationPresent(TableField.class)) {
+                    TableField annotation = field.getAnnotation(TableField.class);
+                    if (!annotation.exist()) {
+                        continue;
+                    }
+                    String column = annotation.value();
+                    if (!Cools.isEmpty(column)) {
+                        return column;
+                    }
+                }
+                // 濡傛灉娌℃湁@TableField娉ㄨВ锛屼娇鐢╤umpToLine杞崲
+                return humpToLine(fieldName);
+            }
+        }
+        // 濡傛灉鎵句笉鍒板瓧娈碉紝浣跨敤humpToLine杞崲
+        return humpToLine(fieldName);
+    }
+
+    @RequestMapping(value = "/materialReceive/delete/auth")
+    @ManagerAuth
+    public R delete(@RequestParam String param) {
+        com.alibaba.fastjson.JSONArray jsonArray = com.alibaba.fastjson.JSONArray.parseArray(param);
+        List<MaterialReceive> list = jsonArray.toJavaList(MaterialReceive.class);
+        if (Cools.isEmpty(list)) {
+            return R.error("璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁");
+        }
+        for (MaterialReceive entity : list) {
+            materialReceiveService.deleteById(entity.getId());
+        }
+        return R.ok();
+    }
+}
diff --git a/src/main/java/com/zy/asrs/entity/MaterialReceive.java b/src/main/java/com/zy/asrs/entity/MaterialReceive.java
new file mode 100644
index 0000000..a8318a4
--- /dev/null
+++ b/src/main/java/com/zy/asrs/entity/MaterialReceive.java
@@ -0,0 +1,255 @@
+package com.zy.asrs.entity;
+
+import com.baomidou.mybatisplus.annotations.TableField;
+import com.baomidou.mybatisplus.annotations.TableId;
+import com.baomidou.mybatisplus.annotations.TableName;
+import com.baomidou.mybatisplus.enums.IdType;
+import com.core.common.Cools;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * 鐢熶骇棰嗘枡鍗曞疄浣撶被
+ */
+@TableName("erp_material_receive")
+@Data
+public class MaterialReceive implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * ID
+     */
+    @ApiModelProperty(value = "ID")
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 鐢熶骇鍗曞彿
+     */
+    @ApiModelProperty(value = "鐢熶骇鍗曞彿")
+    @TableField("so_code")
+    private String soCode;
+
+    /**
+     * 鐗╂枡缂栫爜
+     */
+    @ApiModelProperty(value = "鐗╂枡缂栫爜")
+    @TableField("inv_code")
+    private String invCode;
+
+    /**
+     * 鐗╂枡鍚嶇О
+     */
+    @ApiModelProperty(value = "鐗╂枡鍚嶇О")
+    @TableField("inv_name")
+    private String invName;
+
+    /**
+     * 瑙勬牸鍨嬪彿
+     */
+    @ApiModelProperty(value = "瑙勬牸鍨嬪彿")
+    @TableField("inv_std")
+    private String invStd;
+
+    /**
+     * 鏁伴噺
+     */
+    @ApiModelProperty(value = "鏁伴噺")
+    @TableField("qty")
+    private BigDecimal qty;
+
+    /**
+     * 鍗曚綅
+     */
+    @ApiModelProperty(value = "鍗曚綅")
+    @TableField("unit")
+    private String unit;
+
+    /**
+     * 閮ㄩ棬鍚嶇О
+     */
+    @ApiModelProperty(value = "閮ㄩ棬鍚嶇О")
+    @TableField("dep_name")
+    private String depName;
+
+    /**
+     * 閮ㄩ棬缂栫爜
+     */
+    @ApiModelProperty(value = "閮ㄩ棬缂栫爜")
+    @TableField("dep_code")
+    private String depCode;
+
+    /**
+     * 閮ㄩ棬ID
+     */
+    @ApiModelProperty(value = "閮ㄩ棬ID")
+    @TableField("dep_id")
+    private Integer depId;
+
+    /**
+     * 浠撳簱ID
+     */
+    @ApiModelProperty(value = "浠撳簱ID")
+    @TableField("wh_id")
+    private Integer whId;
+
+    /**
+     * 浠撳簱鍚嶇О
+     */
+    @ApiModelProperty(value = "浠撳簱鍚嶇О")
+    @TableField("wh_name")
+    private String whName;
+
+    /**
+     * 璁″垝寮�宸ユ棩鏈�
+     */
+    @ApiModelProperty(value = "璁″垝寮�宸ユ棩鏈�")
+    @TableField("fplancommitdate")
+    private Date fplancommitdate;
+
+    /**
+     * ERP鍐呴儴ID
+     */
+    @ApiModelProperty(value = "ERP鍐呴儴ID")
+    @TableField("finterid")
+    private Integer finterid;
+
+    /**
+     * 鍑哄簱鏁伴噺
+     */
+    @ApiModelProperty(value = "鍑哄簱鏁伴噺")
+    @TableField("out_qty")
+    private BigDecimal outQty;
+
+    /**
+     * 鍓╀綑鏁伴噺
+     */
+    @ApiModelProperty(value = "鍓╀綑鏁伴噺")
+    @TableField("remain_qty")
+    private BigDecimal remainQty;
+
+    /**
+     * 鏄惁鍏ㄩ儴鍑哄簱瀹屾垚 0-鏈畬鎴� 1-宸插畬鎴�
+     */
+    @ApiModelProperty(value = "鏄惁鍏ㄩ儴鍑哄簱瀹屾垚")
+    @TableField("is_all_out")
+    private Integer isAllOut;
+
+    /**
+     * 鍚屾鏃堕棿
+     */
+    @ApiModelProperty(value = "鍚屾鏃堕棿")
+    @TableField("sync_time")
+    private Date syncTime;
+
+    /**
+     * 鍒涘缓鏃堕棿
+     */
+    @ApiModelProperty(value = "鍒涘缓鏃堕棿")
+    @TableField("create_time")
+    private Date createTime;
+
+    /**
+     * 鏇存柊鏃堕棿
+     */
+    @ApiModelProperty(value = "鏇存柊鏃堕棿")
+    @TableField("update_time")
+    private Date updateTime;
+
+    /**
+     * 浠诲姟鍗曞彿
+     */
+    @ApiModelProperty(value = "浠诲姟鍗曞彿")
+    @TableField("fbillno")
+    private String fbillno;
+
+    /**
+     * 鐗╂枡ID
+     */
+    @ApiModelProperty(value = "鐗╂枡ID")
+    @TableField("fitemid")
+    private Integer fitemid;
+
+    /**
+     * 鏁伴噺锛團Qty锛�
+     */
+    @ApiModelProperty(value = "鏁伴噺锛團Qty锛�")
+    @TableField("fqty")
+    private BigDecimal fqty;
+
+    /**
+     * 杈呭姪鏁伴噺
+     */
+    @ApiModelProperty(value = "杈呭姪鏁伴噺")
+    @TableField("fauxqty")
+    private BigDecimal fauxqty;
+
+    /**
+     * 鍗曚綅ID
+     */
+    @ApiModelProperty(value = "鍗曚綅ID")
+    @TableField("funitid")
+    private Integer funitid;
+
+    /**
+     * 杞﹂棿ID
+     */
+    @ApiModelProperty(value = "杞﹂棿ID")
+    @TableField("fworkshop")
+    private Integer fworkshop;
+
+    /**
+     * 璁″垝瀹屽伐鏃ユ湡
+     */
+    @ApiModelProperty(value = "璁″垝瀹屽伐鏃ユ湡")
+    @TableField("fplanfinishdate")
+    private Date fplanfinishdate;
+
+    /**
+     * 鎵╁睍鏁版嵁锛圝SON鏍煎紡锛屽瓨鍌ㄥ叾浠栧瓧娈碉級
+     */
+    @ApiModelProperty(value = "鎵╁睍鏁版嵁")
+    @TableField("ext_data")
+    private String extData;
+
+    public String getFplancommitdate$() {
+        if (Cools.isEmpty(this.fplancommitdate)) {
+            return "";
+        }
+        return new SimpleDateFormat("yyyy-MM-dd").format(this.fplancommitdate);
+    }
+
+    public String getSyncTime$() {
+        if (Cools.isEmpty(this.syncTime)) {
+            return "";
+        }
+        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.syncTime);
+    }
+
+    public String getCreateTime$() {
+        if (Cools.isEmpty(this.createTime)) {
+            return "";
+        }
+        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime);
+    }
+
+    public String getUpdateTime$() {
+        if (Cools.isEmpty(this.updateTime)) {
+            return "";
+        }
+        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime);
+    }
+
+    public String getFplanfinishdate$() {
+        if (Cools.isEmpty(this.fplanfinishdate)) {
+            return "";
+        }
+        return new SimpleDateFormat("yyyy-MM-dd").format(this.fplanfinishdate);
+    }
+}
diff --git a/src/main/java/com/zy/asrs/mapper/MaterialReceiveMapper.java b/src/main/java/com/zy/asrs/mapper/MaterialReceiveMapper.java
new file mode 100644
index 0000000..6351e5c
--- /dev/null
+++ b/src/main/java/com/zy/asrs/mapper/MaterialReceiveMapper.java
@@ -0,0 +1,12 @@
+package com.zy.asrs.mapper;
+
+import com.zy.asrs.entity.MaterialReceive;
+import com.baomidou.mybatisplus.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Repository;
+
+@Mapper
+@Repository
+public interface MaterialReceiveMapper extends BaseMapper<MaterialReceive> {
+
+}
diff --git a/src/main/java/com/zy/asrs/service/MaterialReceiveService.java b/src/main/java/com/zy/asrs/service/MaterialReceiveService.java
new file mode 100644
index 0000000..82e4fa8
--- /dev/null
+++ b/src/main/java/com/zy/asrs/service/MaterialReceiveService.java
@@ -0,0 +1,8 @@
+package com.zy.asrs.service;
+
+import com.zy.asrs.entity.MaterialReceive;
+import com.baomidou.mybatisplus.service.IService;
+
+public interface MaterialReceiveService extends IService<MaterialReceive> {
+
+}
diff --git a/src/main/java/com/zy/asrs/service/impl/MaterialReceiveServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MaterialReceiveServiceImpl.java
new file mode 100644
index 0000000..67a7bc4
--- /dev/null
+++ b/src/main/java/com/zy/asrs/service/impl/MaterialReceiveServiceImpl.java
@@ -0,0 +1,12 @@
+package com.zy.asrs.service.impl;
+
+import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import com.zy.asrs.entity.MaterialReceive;
+import com.zy.asrs.mapper.MaterialReceiveMapper;
+import com.zy.asrs.service.MaterialReceiveService;
+import org.springframework.stereotype.Service;
+
+@Service("materialReceiveService")
+public class MaterialReceiveServiceImpl extends ServiceImpl<MaterialReceiveMapper, MaterialReceive> implements MaterialReceiveService {
+
+}
diff --git a/src/main/java/materialReceive.sql b/src/main/java/materialReceive.sql
new file mode 100644
index 0000000..61e5125
--- /dev/null
+++ b/src/main/java/materialReceive.sql
@@ -0,0 +1,42 @@
+-- 鐢熶骇棰嗘枡鍗曡〃锛堟墿灞曞瓧娈典互鏀寔瀹屾暣鏁版嵁锛�
+CREATE TABLE [dbo].[erp_material_receive](
+    [id] [bigint] IDENTITY(1,1) NOT NULL,
+    -- 鍩虹瀛楁
+    [so_code] [nvarchar](100) NULL,
+    [fbillno] [nvarchar](100) NULL,
+    [inv_code] [nvarchar](100) NULL,
+    [inv_name] [nvarchar](200) NULL,
+    [inv_std] [nvarchar](200) NULL,
+    [qty] [decimal](18, 2) NULL,
+    [fqty] [decimal](18, 2) NULL,
+    [fauxqty] [decimal](18, 2) NULL,
+    [unit] [nvarchar](50) NULL,
+    [funitid] [int] NULL,
+    [dep_name] [nvarchar](100) NULL,
+    [dep_code] [nvarchar](50) NULL,
+    [dep_id] [int] NULL,
+    [fworkshop] [int] NULL,
+    [wh_id] [int] NULL,
+    [wh_name] [nvarchar](100) NULL,
+    [fplancommitdate] [datetime] NULL,
+    [fplanfinishdate] [datetime] NULL,
+    [finterid] [int] NULL,
+    [fitemid] [int] NULL,
+    -- 鍑哄簱鐩稿叧瀛楁
+    [out_qty] [decimal](18, 2) NULL DEFAULT 0,
+    [remain_qty] [decimal](18, 2) NULL DEFAULT 0,
+    [is_all_out] [int] NULL DEFAULT 0,
+    -- 鍚屾鐩稿叧瀛楁
+    [sync_time] [datetime] NULL,
+    [create_time] [datetime] NULL DEFAULT GETDATE(),
+    [update_time] [datetime] NULL DEFAULT GETDATE(),
+    -- 鎵╁睍瀛楁锛堢敤浜庡瓨鍌ㄦ洿澶欵RP瀛楁锛孞SON鏍煎紡锛�
+    [ext_data] [nvarchar](max) NULL,
+    CONSTRAINT [PK_erp_material_receive] PRIMARY KEY CLUSTERED ([id] ASC)
+)
+
+-- 鍒涘缓绱㈠紩
+CREATE INDEX [IX_erp_material_receive_so_code] ON [dbo].[erp_material_receive] ([so_code])
+CREATE INDEX [IX_erp_material_receive_inv_code] ON [dbo].[erp_material_receive] ([inv_code])
+CREATE INDEX [IX_erp_material_receive_finterid] ON [dbo].[erp_material_receive] ([finterid])
+CREATE INDEX [IX_erp_material_receive_sync] ON [dbo].[erp_material_receive] ([so_code], [inv_code], [finterid])
diff --git a/src/main/resources/mapper/MaterialReceiveMapper.xml b/src/main/resources/mapper/MaterialReceiveMapper.xml
new file mode 100644
index 0000000..dc713ad
--- /dev/null
+++ b/src/main/resources/mapper/MaterialReceiveMapper.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.zy.asrs.mapper.MaterialReceiveMapper">
+
+    <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+    <resultMap id="BaseResultMap" type="com.zy.asrs.entity.MaterialReceive">
+        <id column="id" property="id" />
+        <result column="so_code" property="soCode" />
+        <result column="inv_code" property="invCode" />
+        <result column="inv_name" property="invName" />
+        <result column="inv_std" property="invStd" />
+        <result column="qty" property="qty" />
+        <result column="unit" property="unit" />
+        <result column="dep_name" property="depName" />
+        <result column="dep_code" property="depCode" />
+        <result column="dep_id" property="depId" />
+        <result column="wh_id" property="whId" />
+        <result column="wh_name" property="whName" />
+        <result column="fplancommitdate" property="fplancommitdate" />
+        <result column="finterid" property="finterid" />
+        <result column="out_qty" property="outQty" />
+        <result column="remain_qty" property="remainQty" />
+        <result column="is_all_out" property="isAllOut" />
+        <result column="sync_time" property="syncTime" />
+        <result column="create_time" property="createTime" />
+        <result column="update_time" property="updateTime" />
+        <result column="fbillno" property="fbillno" />
+        <result column="fitemid" property="fitemid" />
+        <result column="fqty" property="fqty" />
+        <result column="fauxqty" property="fauxqty" />
+        <result column="funitid" property="funitid" />
+        <result column="fworkshop" property="fworkshop" />
+        <result column="fplanfinishdate" property="fplanfinishdate" />
+        <result column="ext_data" property="extData" />
+    </resultMap>
+
+</mapper>
diff --git a/src/main/webapp/views/materialReceive/materialReceive.html b/src/main/webapp/views/materialReceive/materialReceive.html
new file mode 100644
index 0000000..ff430f7
--- /dev/null
+++ b/src/main/webapp/views/materialReceive/materialReceive.html
@@ -0,0 +1,359 @@
+<!DOCTYPE html>
+<html lang="en">
+
+<head>
+    <meta charset="utf-8">
+    <title>鐢熸垚棰嗘枡鍗曠鐞�</title>
+    <meta name="renderer" content="webkit">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+    <link rel="stylesheet" href="../../static/evn/index.css">
+</head>
+
+<body>
+    <div id="app">
+        <el-card>
+            <!-- 鎼滅储琛ㄥ崟 -->
+            <el-form :inline="true">
+                <el-form-item label="鐢熶骇鍗曞彿">
+                    <el-input v-model="tableSearchParam.soCode" placeholder="璇疯緭鍏ョ敓浜у崟鍙�"></el-input>
+                </el-form-item>
+                <el-form-item label="浠诲姟鍗曞彿">
+                    <el-input v-model="tableSearchParam.fbillno" placeholder="璇疯緭鍏ヤ换鍔″崟鍙�"></el-input>
+                </el-form-item>
+                <el-form-item label="鐗╂枡缂栫爜">
+                    <el-input v-model="tableSearchParam.invCode" placeholder="璇疯緭鍏ョ墿鏂欑紪鐮�"></el-input>
+                </el-form-item>
+                <el-form-item label="鐗╂枡鍚嶇О">
+                    <el-input v-model="tableSearchParam.invName" placeholder="璇疯緭鍏ョ墿鏂欏悕绉�"></el-input>
+                </el-form-item>
+                <el-form-item label="閮ㄩ棬鍚嶇О">
+                    <el-input v-model="tableSearchParam.depName" placeholder="璇疯緭鍏ラ儴闂ㄥ悕绉�"></el-input>
+                </el-form-item>
+                <el-form-item label="">
+                    <el-button type="primary" @click="search" circle>
+                        <el-icon>
+                            <Search />
+                        </el-icon>
+                    </el-button>
+                    <el-button @click="reset" circle style="margin-left: 10px">
+                        <el-icon>
+                            <Refresh />
+                        </el-icon>
+                    </el-button>
+                </el-form-item>
+            </el-form>
+
+            <!-- 宸ュ叿鏍� -->
+            <el-form :inline="true" style="display: none;">
+                <el-form-item label="">
+                    <el-button type="danger" @click="selectDelete">鍒犻櫎</el-button>
+                    <el-button type="success" @click="exportData">瀵煎嚭</el-button>
+                </el-form-item>
+            </el-form>
+
+            <!-- 鏁版嵁琛ㄦ牸 -->
+            <el-table :data="tableData" border style="width: 100%" @selection-change="handleSelectionChange"
+                max-height="550">
+                <el-table-column type="selection"></el-table-column>
+                <el-table-column type="index" width="50"></el-table-column>
+                <el-table-column prop="soCode" label="鐢熶骇鍗曞彿" width="120"
+                    :show-overflow-tooltip="true"></el-table-column>
+                <el-table-column prop="invCode" label="鐗╂枡缂栫爜" width="120"
+                    :show-overflow-tooltip="true"></el-table-column>
+                <el-table-column prop="invName" label="鐗╂枡鍚嶇О" width="200"
+                    :show-overflow-tooltip="true"></el-table-column>
+                <el-table-column prop="invStd" label="瑙勬牸鍨嬪彿" width="150"
+                    :show-overflow-tooltip="true"></el-table-column>
+                <el-table-column prop="fbillno" label="浠诲姟鍗曞彿" width="120"
+                    :show-overflow-tooltip="true"></el-table-column>
+                <el-table-column prop="qty" label="鎬绘暟閲�" width="100">
+                    <template #default="scope">
+                        {{ scope.row.fqty || scope.row.qty || 0 }}
+                    </template>
+                </el-table-column>
+                <el-table-column prop="unit" label="鍗曚綅" width="80"></el-table-column>
+                <el-table-column prop="depName" label="閮ㄩ棬鍚嶇О" width="120"></el-table-column>
+                <el-table-column prop="depCode" label="閮ㄩ棬缂栫爜" width="120"></el-table-column>
+                <el-table-column prop="whName" label="浠撳簱鍚嶇О" width="120"></el-table-column>
+                <el-table-column prop="fplancommitdate$" label="璁″垝寮�宸ユ棩鏈�" width="120"></el-table-column>
+                <el-table-column prop="fplanfinishdate$" label="璁″垝瀹屽伐鏃ユ湡" width="120"></el-table-column>
+                <el-table-column prop="outQty" label="宸插嚭搴撴暟閲�" width="110">
+                    <template #default="scope">
+                        <span :style="{ color: scope.row.outQty > 0 ? 'green' : 'gray' }">
+                            {{ scope.row.outQty || 0 }}
+                        </span>
+                    </template>
+                </el-table-column>
+                <el-table-column prop="remainQty" label="鍓╀綑鏁伴噺" width="110">
+                    <template #default="scope">
+                        <span :style="{ color: scope.row.remainQty > 0 ? 'orange' : 'green' }">
+                            {{ scope.row.remainQty || 0 }}
+                        </span>
+                    </template>
+                </el-table-column>
+                <el-table-column prop="isAllOut" label="鍑哄簱鐘舵��" width="100">
+                    <template #default="scope">
+                        <el-tag v-if="scope.row.isAllOut == 1" type="success">宸插畬鎴�</el-tag>
+                        <el-tag v-else type="warning">鏈畬鎴�</el-tag>
+                    </template>
+                </el-table-column>
+                <el-table-column prop="syncTime$" label="鍚屾鏃堕棿" width="160"></el-table-column>
+                <el-table-column prop="createTime$" label="鍒涘缓鏃堕棿" width="160"></el-table-column>
+                <el-table-column prop="updateTime$" label="鏇存柊鏃堕棿" width="160"></el-table-column>
+            </el-table>
+
+            <!-- 鍒嗛〉 -->
+            <div style="margin-top: 10px">
+                <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
+                    :current-page="currentPage" :page-sizes="pageSizes" :page-size="pageSize"
+                    layout="total, sizes, prev, pager, next, jumper" :total="pageTotal">
+                </el-pagination>
+            </div>
+        </el-card>
+    </div>
+
+    <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
+    <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script>
+    <script src="../../static/evn/vue.global.js"></script>
+    <script src="../../static/evn/element-plus.js"></script>
+    <script src="../../static/evn/icons-vue.js"></script>
+    <script type="module">
+        // 瀵煎叆涓枃璇█鍖�
+        import zhCn from '../../static/evn/zh-cn.js';
+
+        const { createApp, ref } = Vue;
+
+        const app = createApp({
+            setup() {
+                const currentPage = ref(1)
+                const pageSizes = ref([15, 20, 30, 50, 100, 200])
+                const pageSize = ref(15)
+                const pageTotal = ref(0)
+                const tableSearchParam = ref({
+                    soCode: null,
+                    fbillno: null,
+                    invCode: null,
+                    invName: null,
+                    depName: null
+                })
+                const tableData = ref([])
+                const selectList = ref([])
+
+                function handleSelectionChange(selection) {
+                    selectList.value = selection
+                }
+
+                function handleSizeChange(val) {
+                    pageSize.value = val
+                    search()
+                }
+
+                function handleCurrentChange(val) {
+                    currentPage.value = val
+                    search()
+                }
+
+                function search() {
+                    const loading = ElementPlus.ElLoading.service({
+                        lock: true,
+                        text: 'Loading',
+                        background: 'rgba(0, 0, 0, 0.7)',
+                    })
+                    let data = JSON.parse(JSON.stringify(tableSearchParam.value))
+                    data.curr = currentPage.value
+                    data.limit = pageSize.value
+                    // 绉婚櫎绌哄��
+                    Object.keys(data).forEach(key => {
+                        if (data[key] === null || data[key] === '' || data[key] === undefined) {
+                            delete data[key]
+                        }
+                    })
+                    $.ajax({
+                        url: baseUrl + "/materialReceive/list/auth",
+                        headers: { 'token': localStorage.getItem('token') },
+                        data: data,
+                        dataType: 'json',
+                        method: 'GET',
+                        success: function (res) {
+                            if (res.code == 200) {
+                                tableData.value = res.data.records || []
+                                pageTotal.value = res.data.total || 0
+                            } else if (res.code === 403) {
+                                top.location.href = baseUrl + "/";
+                            } else {
+                                ElementPlus.ElMessage({ message: res.msg, type: 'error' });
+                            }
+                        },
+                        complete: function () {
+                            loading.close()
+                        }
+                    });
+                }
+
+                function selectDelete() {
+                    if (selectList.value.length === 0) {
+                        ElementPlus.ElMessage({
+                            message: "璇峰厛閫夋嫨瑕佸垹闄ょ殑鏁版嵁",
+                            type: 'warning'
+                        });
+                        return;
+                    }
+                    ElementPlus.ElMessageBox.confirm('纭畾瑕佸垹闄ら�変腑鐨勬暟鎹悧?', '鎻愮ず', {
+                        confirmButtonText: '纭畾',
+                        cancelButtonText: '鍙栨秷',
+                        type: 'warning'
+                    }).then(() => {
+                        const loading = ElementPlus.ElLoading.service({
+                            lock: true,
+                            text: '鍒犻櫎涓�...',
+                            background: 'rgba(0, 0, 0, 0.7)',
+                        })
+                        $.ajax({
+                            url: baseUrl + "/materialReceive/delete/auth",
+                            headers: { 'token': localStorage.getItem('token') },
+                            data: {
+                                param: JSON.stringify(selectList.value)
+                            },
+                            dataType: 'json',
+                            method: 'POST',
+                            success: function (res) {
+                                if (res.code == 200) {
+                                    ElementPlus.ElMessage({
+                                        message: "鍒犻櫎鎴愬姛",
+                                        type: 'success'
+                                    });
+                                    search()
+                                } else if (res.code === 403) {
+                                    top.location.href = baseUrl + "/";
+                                } else {
+                                    ElementPlus.ElMessage({ message: res.msg, type: 'error' });
+                                }
+                            },
+                            complete: function () {
+                                loading.close()
+                            }
+                        });
+                    }).catch(() => {
+                        // 鍙栨秷
+                    });
+                }
+
+                function reset() {
+                    tableSearchParam.value = {
+                        soCode: null,
+                        fbillno: null,
+                        invCode: null,
+                        invName: null,
+                        depName: null
+                    }
+                    currentPage.value = 1
+                    search()
+                }
+
+                function exportData() {
+                    if (selectList.value.length === 0) {
+                        ElementPlus.ElMessage({
+                            message: "璇峰厛閫夋嫨瑕佸鍑虹殑鏁版嵁",
+                            type: 'warning'
+                        });
+                        return;
+                    }
+                    // 鏋勫缓瀵煎嚭鏁版嵁
+                    const exportData = selectList.value.map(item => ({
+                        soCode: item.soCode || '',
+                        invCode: item.invCode || '',
+                        invName: item.invName || '',
+                        invStd: item.invStd || '',
+                        qty: item.qty || 0,
+                        unit: item.unit || '',
+                        depName: item.depName || '',
+                        depCode: item.depCode || '',
+                        whName: item.whName || '',
+                        fplancommitdate: item.fplancommitdate$ || '',
+                        outQty: item.outQty || 0,
+                        remainQty: item.remainQty || 0,
+                        isAllOut: item.isAllOut == 1 ? '宸插畬鎴�' : '鏈畬鎴�',
+                        syncTime: item.syncTime$ || '',
+                        createTime: item.createTime$ || '',
+                        updateTime: item.updateTime$ || ''
+                    }));
+
+                    // 杞崲涓篊SV鏍煎紡
+                    const headers = ['鐢熶骇鍗曞彿', '鐗╂枡缂栫爜', '鐗╂枡鍚嶇О', '瑙勬牸鍨嬪彿', '鎬绘暟閲�', '鍗曚綅', '閮ㄩ棬鍚嶇О', '閮ㄩ棬缂栫爜', '浠撳簱鍚嶇О', '璁″垝寮�宸ユ棩鏈�', '宸插嚭搴撴暟閲�', '鍓╀綑鏁伴噺', '鍑哄簱鐘舵��', '鍚屾鏃堕棿', '鍒涘缓鏃堕棿', '鏇存柊鏃堕棿'];
+                    const csvContent = [
+                        headers.join(','),
+                        ...exportData.map(row => [
+                            row.soCode,
+                            row.invCode,
+                            row.invName,
+                            row.invStd,
+                            row.qty,
+                            row.unit,
+                            row.depName,
+                            row.depCode,
+                            row.whName,
+                            row.fplancommitdate,
+                            row.outQty,
+                            row.remainQty,
+                            row.isAllOut,
+                            row.syncTime,
+                            row.createTime,
+                            row.updateTime
+                        ].map(cell => `"${cell}"`).join(','))
+                    ].join('\n');
+
+                    // 涓嬭浇鏂囦欢
+                    const blob = new Blob(['\uFEFF' + csvContent], { type: 'text/csv;charset=utf-8;' });
+                    const link = document.createElement('a');
+                    const url = URL.createObjectURL(blob);
+                    link.setAttribute('href', url);
+                    link.setAttribute('download', '鐢熸垚棰嗘枡鍗曟暟鎹甠' + new Date().getTime() + '.csv');
+                    link.style.visibility = 'hidden';
+                    document.body.appendChild(link);
+                    link.click();
+                    document.body.removeChild(link);
+
+                    ElementPlus.ElMessage({
+                        message: "瀵煎嚭鎴愬姛",
+                        type: 'success'
+                    });
+                }
+
+                // 鍒濆鍖栧姞杞�
+                search()
+
+                return {
+                    currentPage,
+                    pageSizes,
+                    pageSize,
+                    pageTotal,
+                    tableSearchParam,
+                    tableData,
+                    selectList,
+                    handleSelectionChange,
+                    handleSizeChange,
+                    handleCurrentChange,
+                    search,
+                    reset,
+                    selectDelete,
+                    exportData
+                }
+            }
+        })
+
+        // 閰嶇疆Element Plus涓枃璇█鍖�
+        app.use(ElementPlus, {
+            locale: zhCn
+        })
+        
+        // 娉ㄥ唽鎵�鏈夊浘鏍囩粍浠�
+        for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
+            app.component(key, component)
+        }
+
+        app.mount('#app')
+    </script>
+</body>
+
+</html>
diff --git a/src/main/webapp/views/pda/materialReceiveOut.html b/src/main/webapp/views/pda/materialReceiveOut.html
new file mode 100644
index 0000000..70f98ab
--- /dev/null
+++ b/src/main/webapp/views/pda/materialReceiveOut.html
@@ -0,0 +1,489 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>鐢熸垚棰嗘枡鍑哄簱</title>
+    <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all">
+    <link rel="stylesheet" href="../../static/css/pda.css" media="all">
+    <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
+    <script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script>
+    <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script>
+    <script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script>
+</head>
+<style>
+    .form-box span {
+        font-size: 16px;
+        display: inline-block;
+        text-align: right;
+    }
+    .form-box input {
+        width: 165px;
+        padding-left: 5px;
+        height: 30px;
+        border: 1px solid #777777;
+        overflow:hidden;
+        white-space:nowrap;
+        text-overflow:ellipsis;
+    }
+    .number-tool {
+        margin-left: 10px;
+        padding: 1px 0 1px 5px;
+        display: inline-block;
+        width: 120px;
+    }
+
+    .number-tool:after {
+        clear: both;
+        content: "";
+        display: table;
+    }
+
+    .number-tool button {
+        background-color: #fff;
+        margin-top: 3px;
+        font-size: 16px;
+        height: 25px;
+        float: left;
+        width: 25px;
+        border: 1px solid #777777;
+    }
+
+    .number-tool input {
+        text-align: center;
+        height: 30px;
+        float: left;
+        margin: 0 5px;
+        width: 50px;
+        padding: 0;
+    }
+</style>
+<body>
+
+<header class="layui-form">
+    <div class="layui-input-inline">
+        <label class="layui-form-label" >鐢熶骇鍗曞彿</label>
+        <div class="layui-input-inline">
+            <input id="soCode" class="layui-input" autocomplete="off" oninput="findCode(this, 'soCode')"
+                   placeholder="鎵爜 / 杈撳叆"   style="width: 175px">
+        </div>
+    </div>
+    <div class="layui-input-inline">
+        <label class="layui-form-label">浠诲姟鍗曞彿</label>
+        <input class="layui-input" id="fbillno" onkeyup="findCode(this, 'fbillno')" placeholder="鎵爜 / 杈撳叆"
+               style="width: 175px"
+               autocomplete="off">
+    </div>
+    <div class="layui-input-inline">
+        <label class="layui-form-label">鐗╂枡缂栫爜</label>
+        <input class="layui-input" id="invCode" onkeyup="findCode(this, 'invCode')" placeholder="鎵爜 / 杈撳叆"
+               style="width: 175px"
+               autocomplete="off">
+    </div>
+</header>
+
+<main>
+    <table class="layui-table" id="materialReceiveOut" lay-filter="materialReceiveOut"></table>
+</main>
+
+<footer>
+    <div class="layui-btn-container">
+        <button type="button" id="reset-btn" class="layui-btn layui-btn-primary" onclick="reset()">閲嶇疆</button>
+        <button type="button" id="out-btn" class="layui-btn layui-btn-normal " onclick="materialReceiveOut()"
+                style="margin-left: 20px">鍑哄簱
+        </button>
+        <button type="button" id="retrun-btn" class="layui-btn layui-btn-primary " onclick="back()"
+                style="margin-left: 20px">杩斿洖
+        </button>
+        <span id="tips"></span>
+    </div>
+</footer>
+
+<!-- 淇敼鏁伴噺寮圭獥 -->
+<div id="modify" style="display: none; padding-top: 10px; text-align: center;">
+    <div class="form-box">
+        <div class="form-item">
+            <table style="display: inline">
+                <tr>
+                    <td>
+                        <span style="width: 35px; margin-right: 5px">缂栫爜</span>
+                    </td>
+                    <td style="text-align: left">
+                        <input id="invCode2" type="text" disabled="disabled">
+                    </td>
+                </tr>
+            </table>
+        </div>
+        <div class="form-item">
+            <table style="display: inline">
+                <tr>
+                    <td style="vertical-align: top">
+                        <span style="width: 35px; margin-right: 5px">鍚嶇О</span>
+                    </td>
+                    <td style="text-align: left">
+                    <textarea rows="3" style="resize: none; width: 165px" id="invName2" type="text" disabled="disabled"
+                              readonly="readonly"></textarea>
+                    </td>
+                </tr>
+            </table>
+        </div>
+    </div>
+    <input id="index" type="text" disabled="disabled" style="display: none;">
+    <div class="form-item" style="margin-top: 5px; margin-bottom: 8px;">
+        <span style="vertical-align: middle">鏁伴噺</span>
+        <div class="number-tool" style="vertical-align: middle">
+            <button onclick="reduce()">-</button>
+            <input id="outQtyInput" type="number" onchange="fix(this)">
+            <button onclick="add()">+</button>
+        </div>
+    </div>
+    <button id="remove" onclick="remove()">绉婚櫎</button>
+    <button id="confirm" onclick="confirm()">淇濆瓨</button>
+</div>
+
+</body>
+<script>
+    var countLayer;
+    // 褰撳墠鐐瑰嚮鐗╂枡鐨勬渶澶у墿浣欐暟閲�
+    var maxRemainQty;
+    // 琛ㄦ牸鏁版嵁
+    var materialReceiveList = [];
+    window.onload = function () {
+        document.getElementById("soCode").focus();
+    }
+
+    /**
+     * 鎻愮ず淇℃伅
+     * @param msg 鎻愮ず鍐呭
+     * @param warn true锛氱孩鑹插瓧浣�
+     */
+    function tips(msg, warn) {
+        layer.msg(msg, {icon: warn ? 2 : 1})
+    }
+
+    function back() {
+        parent.backIndex();
+    }
+
+    var tableIns;
+    layui.use(['table', 'form'], function () {
+        var table = layui.table;
+        var $ = layui.jquery;
+        var layer = layui.layer;
+        var form = layui.form;
+
+        tableIns = table.render({
+            id: 'materialReceiveOut',
+            elem: '#materialReceiveOut',
+            data: [],
+            limit: 500,
+            cellMinWidth: 50,
+            cols: [[
+                {field: 'invCode', align: 'center', title: '缂栫爜', event: 'detail', width: 80},
+                {field: 'fbillno', align: 'center', title: '浠诲姟鍗曞彿', event: 'detail', width: 100},
+                {field: 'invName', align: 'center', title: '鍚嶇О', event: 'detail'},
+                {field: 'whName', align: 'center', title: '搴撳尯', event: 'detail', width: 50},
+                {
+                    field: 'remainQty',
+                    align: 'center',
+                    title: '鏁伴噺',
+                    event: 'detail',
+                    style: 'color: blue',
+                    event: 'modify',
+                    style: 'cursor: pointer;color: blue',
+                    width: 50,
+                    templet: function(d) {
+                        // 鏄剧ず鍑哄簱鏁伴噺锛堝鏋滃凡淇敼锛夋垨鍓╀綑鏁伴噺
+                        // 浼樺厛鏄剧ず淇敼鍚庣殑鍑哄簱鏁伴噺锛屽鏋滄病鏈変慨鏀瑰垯鏄剧ず鍓╀綑鏁伴噺
+                        if (d.outQtyOut !== undefined && d.outQtyOut !== null) {
+                            return d.outQtyOut;
+                        }
+                        return d.remainQty || 0;
+                    }
+                },
+                {type: 'checkbox', fixed: 'right', width: 30},
+            ]],
+            done: function (res, curr, count) {
+            }
+        });
+
+        // 鐩戝惉琛屽伐鍏蜂簨浠�
+        table.on('tool(materialReceiveOut)', function (obj) {
+            var data = obj.data;
+            switch (obj.event) {
+                case 'modify':
+                    countLayer = layer.open({
+                        type: 1,
+                        offset: '20px',
+                        title: '淇敼鏁伴噺',
+                        shadeClose: true,
+                        area: ['80%', '240px'],
+                        content: $("#modify"),
+                        success: function (layero, index) {
+                            $('#invCode2').val(data.invCode);
+                            $('#invName2').val(data.invName);
+                            $('#index').val(data.id);
+                            // 鏄剧ず褰撳墠鍑哄簱鏁伴噺锛堝鏋滃凡淇敼锛夋垨鍓╀綑鏁伴噺
+                            var currentOutQty = (data.outQtyOut !== undefined && data.outQtyOut !== null) ? data.outQtyOut : (data.remainQty || 0);
+                            $('#outQtyInput').val(currentOutQty);
+                            maxRemainQty = parseFloat(data.remainQty) || 0;
+                        }
+                    });
+                    break;
+            }
+        });
+    });
+
+    var soCodeBar;
+    var fbillnoBar;
+    var invCodeBar;
+
+    /* 鎵爜銆佽緭鍏ョ敓浜у崟鍙枫�佷换鍔″崟鍙峰拰鐗╂枡缂栫爜 */
+    function findCode(el, type) {
+        soCodeBar = $('#soCode').val();
+        fbillnoBar = $("#fbillno").val();
+        invCodeBar = $("#invCode").val();
+        
+        // 鍘婚櫎绌烘牸
+        if (soCodeBar) {
+            soCodeBar = soCodeBar.trim();
+        }
+        if (fbillnoBar) {
+            fbillnoBar = fbillnoBar.trim();
+        }
+        if (invCodeBar) {
+            invCodeBar = invCodeBar.trim();
+        }
+        
+        switch (type) {
+            case 'soCode':
+                break;
+            case 'fbillno':
+                break;
+            case 'invCode':
+                break;
+            default:
+                break;
+        }
+
+        // 鏋勫缓鏌ヨ鍙傛暟
+        var params = {};
+        if (soCodeBar) {
+            params.soCode = soCodeBar;
+        }
+        if (fbillnoBar) {
+            params.fbillno = fbillnoBar;
+        }
+        if (invCodeBar) {
+            params.invCode = invCodeBar;
+        }
+
+        // 濡傛灉鎵�鏈夋煡璇㈡潯浠堕兘涓虹┖锛屼笉鎵ц鏌ヨ
+        if (!soCodeBar && !fbillnoBar && !invCodeBar) {
+            // 娓呯┖琛ㄦ牸鏁版嵁
+            tableIns.reload({
+                data: [],
+            });
+            materialReceiveList = [];
+            return;
+        }
+
+        // PDA鍑哄簱鏌ヨ锛屾坊鍔爌daQuery鍙傛暟锛屽悗绔細杩囨护鎺夊凡鍏ㄩ儴鍑哄簱鐨勭墿鏂�
+        params.pdaQuery = true;
+        
+        $.ajax({
+            url: baseUrl + "/materialReceive/list/auth",
+            headers: {'token': localStorage.getItem('token')},
+            data: params,
+            method: 'GET',
+            async: false,
+            success: function (res) {
+                if (res && res.code === 200) {
+                    var records = [];
+                    if (res.data && res.data.records && res.data.records.length > 0) {
+                        records = res.data.records;
+                    } else if (res.data && Array.isArray(res.data)) {
+                        records = res.data;
+                    }
+                    // 鍒濆鍖栧嚭搴撴暟閲忓瓧娈碉紙鍒濆绛変簬鍓╀綑鏁伴噺锛岀敤鎴峰彲浠ヤ慨鏀癸級
+                    records.map(function (item) {
+                        // 濡傛灉杩樻病鏈夎缃嚭搴撴暟閲忥紝鍒欏垵濮嬪寲涓哄墿浣欐暟閲�
+                        if (item.outQtyOut === undefined || item.outQtyOut === null) {
+                            item.outQtyOut = item.remainQty || 0;
+                        }
+                    });
+                    tableIns.reload({
+                        data: records,
+                    });
+                    materialReceiveList = records;
+                } else if (res && res.code === 403) {
+                    top.location.href = baseUrl + "/pda";
+                } else if (res && res.msg) {
+                    tips(res.msg, true)
+                } else {
+                    tips("鏌ヨ澶辫触锛岃绋嶅悗閲嶈瘯", true);
+                }
+            },
+            error: function(xhr, status, error) {
+                console.error("鏌ヨ澶辫触:", status, error);
+                tips("鏌ヨ澶辫触锛岃绋嶅悗閲嶈瘯", true);
+            }
+        });
+    }
+
+    /* 淇敼鏁伴噺 */
+    var countDom = $('#outQtyInput');
+
+    function add() {
+        if (Number(countDom.val()) >= maxRemainQty) {
+            return;
+        }
+        countDom.val(Number(countDom.val()) + 1);
+    }
+
+    function reduce() {
+        if (Number(countDom.val()) <= 0) {
+            return;
+        }
+        countDom.val(Number(countDom.val()) - 1);
+    }
+
+    function fix(e) {
+        var val = Number(e.value) || 0;
+        if (val > maxRemainQty) {
+            countDom.val(maxRemainQty);
+        }
+    }
+
+    function remove() {
+        var invCode = $('#invCode2').val();
+        var id = $('#index').val();
+        for (var j = 0; j < materialReceiveList.length; j++) {
+            if (invCode === materialReceiveList[j].invCode && id == materialReceiveList[j].id) {
+                materialReceiveList.splice(j, 1);
+            }
+        }
+        tableIns.reload({data: materialReceiveList});
+        layer.close(countLayer);
+        tips("绉婚櫎鎴愬姛");
+    }
+
+    // 淇敼鏁伴噺
+    function confirm() {
+        var invCode = $('#invCode2').val();
+        var outQty = parseFloat($('#outQtyInput').val()) || 0;
+        var id = $('#index').val();
+        
+        if (outQty < 0) {
+            tips("鏁伴噺涓嶈兘灏忎簬0", true);
+            return;
+        }
+        
+        if (outQty > maxRemainQty) {
+            tips("鏁伴噺涓嶈兘瓒呰繃鍓╀綑鏁伴噺", true);
+            return;
+        }
+        
+        // 鏇存柊琛ㄦ牸涓殑鍑哄簱鏁伴噺
+        for (var j = 0; j < materialReceiveList.length; j++) {
+            if (invCode === materialReceiveList[j].invCode && id == materialReceiveList[j].id) {
+                materialReceiveList[j].outQtyOut = outQty;
+            }
+        }
+        tableIns.reload({data: materialReceiveList});
+        layer.close(countLayer);
+        tips("淇敼鎴愬姛");
+    }
+
+    /* 鐢熸垚棰嗘枡鍑哄簱 */
+    function materialReceiveOut() {
+        var table = layui.table;
+        var checkStatus = table.checkStatus('materialReceiveOut');
+        var data = checkStatus.data;
+        if (data.length == 0) {
+            layer.msg("璇烽�夋嫨鐗╂枡!");
+            return;
+        }
+        
+        // 鎵归噺鍑哄簱
+        var outQtyList = [];
+        for (var i = 0; i < data.length; i++) {
+            var item = data[i];
+            // 浣跨敤淇敼鍚庣殑鍑哄簱鏁伴噺锛坥utQtyOut锛夛紝濡傛灉娌℃湁淇敼鍒欎娇鐢ㄥ墿浣欐暟閲�
+            var outQty = 0;
+            if (item.outQtyOut !== undefined && item.outQtyOut !== null) {
+                outQty = parseFloat(item.outQtyOut) || 0;
+            } else {
+                outQty = parseFloat(item.remainQty) || 0;
+            }
+            
+            if (outQty <= 0) {
+                tips("鐗╂枡 " + item.invCode + " 鍑哄簱鏁伴噺蹇呴』澶т簬0", true);
+                return;
+            }
+            var remainQty = parseFloat(item.remainQty) || 0;
+            if (outQty > remainQty) {
+                tips("鐗╂枡 " + item.invCode + " 鍑哄簱鏁伴噺涓嶈兘瓒呰繃鍓╀綑鏁伴噺", true);
+                return;
+            }
+            outQtyList.push({
+                id: item.id,
+                outQty: outQty
+            });
+        }
+        
+        // 纭鍑哄簱
+        layer.confirm('纭畾瑕佸嚭搴撻�変腑鐨勭墿鏂欏悧锛�', {icon: 3, title: '鎻愮ず'}, function(index){
+            // 鎵归噺鏇存柊鍑哄簱鏁伴噺
+            var successCount = 0;
+            var failCount = 0;
+            for (var i = 0; i < outQtyList.length; i++) {
+                $.ajax({
+                    url: baseUrl + "/materialReceive/updateOutQty/auth",
+                    headers: {'token': localStorage.getItem('token')},
+                    data: JSON.stringify(outQtyList[i]),
+                    contentType: 'application/json;charset=UTF-8',
+                    method: 'POST',
+                    async: false,
+                    success: function (res) {
+                        if (res && res.code === 200) {
+                            successCount++;
+                        } else {
+                            failCount++;
+                        }
+                    },
+                    error: function(xhr, status, error) {
+                        console.error("鍑哄簱澶辫触:", status, error);
+                        failCount++;
+                    }
+                });
+            }
+            
+            if (successCount > 0) {
+                tips("鎴愬姛鍑哄簱 " + successCount + " 鏉¤褰�");
+                // 娓呯┖杈撳叆妗嗗苟鍒锋柊鍒楄〃
+                $("#soCode").val("");
+                $("#fbillno").val("");
+                $("#invCode").val("");
+                materialReceiveList = [];
+                tableIns.reload({data: materialReceiveList});
+                document.getElementById("soCode").focus();
+            }
+            if (failCount > 0) {
+                tips("鍑哄簱澶辫触 " + failCount + " 鏉¤褰�", true);
+            }
+            
+            layer.close(index);
+        });
+    }
+
+    function reset() {
+        $("#soCode").val(null);
+        $("#fbillno").val(null);
+        $("#invCode").val(null);
+        materialReceiveList = [];
+        tableIns.reload({data: materialReceiveList});
+        layer.closeAll();
+        document.getElementById("soCode").focus();
+    }
+</script>
+</html>

--
Gitblit v1.9.1