From 85b89465f4de41f9a7fea136f2f0897b1da790fa Mon Sep 17 00:00:00 2001
From: skyouc <creaycat@gmail.com>
Date: 星期四, 08 一月 2026 19:57:22 +0800
Subject: [PATCH] 新增订单excel导入功能
---
src/main/java/com/zy/asrs/controller/OrderController.java | 46 ++
src/main/java/com/zy/asrs/entity/OrderDetl.java | 13
src/main/java/com/zy/asrs/utils/OrderExcelListener.java | 127 +++++++
src/main/webapp/static/js/order/order.js | 310 +++++++++++-------
src/main/webapp/static/js/common.js | 252 ++++++++-------
src/main/java/com/zy/common/entity/OrderExcel.java | 18 +
src/main/webapp/views/order/order.html | 178 ++++++----
7 files changed, 633 insertions(+), 311 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/OrderController.java b/src/main/java/com/zy/asrs/controller/OrderController.java
index 4c1bd74..cdc148d 100644
--- a/src/main/java/com/zy/asrs/controller/OrderController.java
+++ b/src/main/java/com/zy/asrs/controller/OrderController.java
@@ -1,5 +1,7 @@
package com.zy.asrs.controller;
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
@@ -12,14 +14,23 @@
import com.zy.asrs.entity.result.WrkTraceVo;
import com.zy.asrs.service.*;
+import com.zy.asrs.utils.MatExcelListener;
+import com.zy.asrs.utils.OrderExcelListener;
+import com.zy.common.entity.MatExcel;
+import com.zy.common.entity.OrderExcel;
import com.zy.common.model.DetlDto;
import com.zy.common.web.BaseController;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import java.io.IOException;
+import java.net.URLEncoder;
import java.util.*;
+
+import javax.servlet.http.HttpServletResponse;
@RestController
public class OrderController extends BaseController {
@@ -357,6 +368,41 @@
}
}
+ /**
+ * excel瀵煎叆妯℃澘涓嬭浇
+ */
+ @RequestMapping(value = "/orders/excel/import/mould")
+ public void matExcelImportMould(HttpServletResponse response) throws IOException {
+ List<OrderExcel> excels = new ArrayList<>();
+ response.setContentType("application/vnd.ms-excel");
+ response.setCharacterEncoding("utf-8");
+ String fileName = URLEncoder.encode("鍗曟嵁Excel瀵煎叆妯℃澘", "UTF-8");
+ response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
+ EasyExcel.write(response.getOutputStream(), OrderExcel.class)
+ .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
+ .sheet("sheet1")
+ .doWrite(excels);
+ }
+
+
+
+ /**
+ * 鍗曟嵁瀵煎叆
+ * @author Ryan
+ * @date 2026/1/8 17:17
+ * @param file
+ * @return com.core.common.R
+ */
+ @PostMapping(value = "/orders/excel/import/auth")
+ @ManagerAuth(memo = "鍗曟嵁瀵煎叆")
+ @Transactional
+ public R matExcelImport(MultipartFile file) throws IOException {
+ OrderExcelListener listener = new OrderExcelListener(getUserId());
+ EasyExcel.read(file.getInputStream(), OrderExcel.class, listener).sheet().doRead();
+ return R.ok("鎴愬姛鍚屾" + listener.getTotal() + "鏉″晢鍝佹暟鎹�");
+ }
+
+
@RequestMapping(value = "/order/update/auth")
@ManagerAuth
public R update(Order order){
diff --git a/src/main/java/com/zy/asrs/entity/OrderDetl.java b/src/main/java/com/zy/asrs/entity/OrderDetl.java
index 006c610..8f25411 100644
--- a/src/main/java/com/zy/asrs/entity/OrderDetl.java
+++ b/src/main/java/com/zy/asrs/entity/OrderDetl.java
@@ -1,5 +1,6 @@
package com.zy.asrs.entity;
+import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
@@ -48,6 +49,7 @@
* 鍗曟嵁缂栧彿
*/
@ApiModelProperty(value= "鍗曟嵁缂栧彿")
+ @ExcelProperty(index = 0, value = "鍗曞彿")
@TableField("order_no")
private String orderNo;
@@ -56,6 +58,7 @@
* 鏁伴噺
*/
@ApiModelProperty(value= "鏁伴噺")
+ @ExcelProperty(value = "鏁伴噺")
private Double anfme;
/**
@@ -81,30 +84,35 @@
* 鍟嗗搧缂栫爜
*/
@ApiModelProperty(value= "鍟嗗搧缂栫爜")
+ @ExcelProperty(value = "鍟嗗搧缂栫爜")
private String matnr;
/**
* 鍟嗗搧鍚嶇О
*/
@ApiModelProperty(value= "鍟嗗搧鍚嶇О")
+ @ExcelProperty(value = "鍟嗗搧鍚嶇О")
private String maktx;
/**
* 鎵瑰彿
*/
@ApiModelProperty(value= "鎵瑰彿")
+ @ExcelProperty(value = "鎵瑰彿")
private String batch;
/**
* 瑙勬牸
*/
@ApiModelProperty(value= "瑙勬牸")
+ @ExcelProperty(value = "瑙勬牸")
private String specs;
/**
* 鍨嬪彿
*/
@ApiModelProperty(value= "鍨嬪彿")
+ @ExcelProperty(value = "鍨嬪彿")
private String model;
/**
@@ -117,12 +125,14 @@
* 鍝佺墝
*/
@ApiModelProperty(value= "鍝佺墝")
+ @ExcelProperty(value = "鍝佺墝")
private String brand;
/**
* 鍗曚綅
*/
@ApiModelProperty(value= "鍗曚綅")
+ @ExcelProperty(value = "鍗曚綅")
private String unit;
/**
@@ -147,6 +157,7 @@
* 鏉$爜
*/
@ApiModelProperty(value= "鏉$爜")
+ @ExcelProperty(value = "SN鐮�")
private String barcode;
/**
@@ -180,6 +191,7 @@
*/
@ApiModelProperty(value= "瀹夊叏搴撳瓨閲�")
@TableField("safe_qty")
+ @ExcelProperty(value = "褰掗浂闃�鍊�")
private Double safeQty;
/**
@@ -199,6 +211,7 @@
* 浣撶Н
*/
@ApiModelProperty(value= "浣撶Н")
+ @ExcelProperty(value = "km/cm")
private Double volume;
/**
diff --git a/src/main/java/com/zy/asrs/utils/OrderExcelListener.java b/src/main/java/com/zy/asrs/utils/OrderExcelListener.java
new file mode 100644
index 0000000..59e6c5e
--- /dev/null
+++ b/src/main/java/com/zy/asrs/utils/OrderExcelListener.java
@@ -0,0 +1,127 @@
+package com.zy.asrs.utils;
+
+import com.alibaba.excel.context.AnalysisContext;
+import com.alibaba.excel.event.AnalysisEventListener;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.core.common.SpringUtils;
+import com.core.exception.CoolException;
+import com.zy.asrs.entity.DocType;
+import com.zy.asrs.entity.Mat;
+import com.zy.asrs.entity.Order;
+import com.zy.asrs.entity.OrderDetl;
+import com.zy.asrs.service.DocTypeService;
+import com.zy.asrs.service.MatService;
+import com.zy.asrs.service.OrderDetlService;
+import com.zy.asrs.service.OrderService;
+import com.zy.common.entity.OrderExcel;
+import lombok.extern.slf4j.Slf4j;
+
+import java.util.*;
+
+import org.springframework.transaction.annotation.Transactional;
+
+@Slf4j
+public class OrderExcelListener extends AnalysisEventListener<OrderExcel> {
+
+ private int total = 0;
+ private Long userId;
+
+ public OrderExcelListener(Long userId) {
+ this.userId = userId;
+ }
+
+ /**
+ * 姣忛殧5鏉″瓨鍌ㄦ暟鎹簱锛屽疄闄呬娇鐢ㄤ腑鍙互3000鏉★紝鐒跺悗娓呯悊list 锛屾柟渚垮唴瀛樺洖鏀�
+ */
+ private static final int BATCH_COUNT = 50;
+
+ private final List<OrderExcel> list = new ArrayList<>();
+
+ /**
+ * 杩欓噷浼氫竴琛岃鐨勮繑鍥炲ご
+ */
+ @Override
+ public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
+
+ }
+
+ /**
+ * 鍗曟嵁瀵煎叆瀹炵幇
+ * @author Ryan
+ * @date 2026/1/8 17:25
+ * @param data
+ * @param context
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void invoke(OrderExcel data, AnalysisContext context) {
+ OrderService orderService = (OrderService) SpringUtils.getBean(OrderService.class);
+ OrderDetlService detlService = (OrderDetlService) SpringUtils.getBean(OrderDetlService.class);
+ MatService matService = SpringUtils.getBean(MatService.class);
+ DocTypeService docTypeService = SpringUtils.getBean(DocTypeService.class);
+ Date now = new Date();
+ if (Objects.isNull(data)) {
+ throw new CoolException("鍙傛暟涓嶈兘涓虹┖锛侊紒");
+ }
+ if (Objects.isNull(data.getOrderNo())) {
+ throw new CoolException("璁㈠崟宸插垱寤猴紝涓嶅彲浠ラ噸澶嶅垱寤猴紒锛�");
+ }
+ if (Objects.isNull(data.getDocType())) {
+ throw new CoolException("鍗曟嵁绫诲瀷涓嶈兘涓虹┖锛�");
+ }
+ DocType docType = docTypeService.selectOne(new EntityWrapper<DocType>().eq("doc_name", data.getDocType()));
+ if (Objects.isNull(docType)) {
+ throw new CoolException("鍗曟嵁绫诲瀷[" + data.getDocType() + "]涓嶅瓨鍦紒锛�");
+ }
+
+ Order order = new Order();
+ order.setOrderNo(data.getOrderNo());
+ order.setDocType(docType.getDocId());
+ order.setCreateTime(now);
+ order.setUpdateTime(now);
+ order.setSettle(1L);
+ order.setStatus(1);
+ order.setCreateBy(userId);
+ order.setUpdateBy(userId);
+ order.setPakinPakoutStatus(docType.getPakin() == 1 ? 1 : 2);
+ if (!orderService.insert(order)) {
+ throw new CoolException("璁㈠崟鍒涘缓澶辫触锛侊紒");
+ }
+ if (Objects.isNull(data.getMatnr())) {
+ throw new CoolException("鐗╂枡缂栫爜涓嶈兘涓虹┖锛�");
+ }
+ Mat mat = matService.selectOne(new EntityWrapper<Mat>().eq("matnr", data.getMatnr()));
+ if (Objects.isNull(mat)) {
+ throw new CoolException("鐗╂枡[" + data.getMatnr() + "]涓嶅瓨鍦紒锛�");
+ }
+ OrderDetl detl = new OrderDetl();
+ detl.setOrderNo(data.getOrderNo());
+ detl.setOrderId(order.getId());
+ detl.setMatnr(data.getMatnr());
+ detl.setMaktx(mat.getMaktx());
+ detl.setQty(data.getQty());
+ detl.setBatch(data.getBatch());
+ detl.setVolume(data.getVolume());
+ detl.setSafeQty(mat.getSafeQty());
+ detl.setAnfme(data.getAnfme());
+ detl.setBarcode(data.getBarcode());
+ detl.setUpdateTime(now);
+ detl.setCreateTime(now);
+ detl.setUpdateBy(userId);
+ detl.setCreateBy(userId);
+ if (!detlService.insert(detl)) {
+ throw new CoolException("璁㈠崟璇︽儏鍒涘缓澶辫触锛侊紒");
+ }
+ }
+
+ @Override
+ public void doAfterAllAnalysed(AnalysisContext context) {
+ log.info("鏂板{}鏉$墿鏂欎俊鎭紒", total);
+ }
+
+ public int getTotal() {
+ return total;
+ }
+
+}
diff --git a/src/main/java/com/zy/common/entity/OrderExcel.java b/src/main/java/com/zy/common/entity/OrderExcel.java
new file mode 100644
index 0000000..180e0f9
--- /dev/null
+++ b/src/main/java/com/zy/common/entity/OrderExcel.java
@@ -0,0 +1,18 @@
+package com.zy.common.entity;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.zy.asrs.entity.OrderDetl;
+import lombok.Data;
+
+@Data
+@ExcelIgnoreUnannotated
+public class OrderExcel extends OrderDetl {
+
+ @ExcelProperty(index = 1, value = "鍗曟嵁绫诲瀷")
+ private String docType;
+
+
+}
+
+
diff --git a/src/main/webapp/static/js/common.js b/src/main/webapp/static/js/common.js
index 98b9937..b826257 100644
--- a/src/main/webapp/static/js/common.js
+++ b/src/main/webapp/static/js/common.js
@@ -6,7 +6,7 @@
var detailWidth = '90%';
// 闈炵┖鍒ゆ柇
-function isEmpty(obj){
+function isEmpty(obj) {
return typeof obj == "undefined" || obj == null || obj === "";
}
@@ -34,7 +34,7 @@
if (p < 10) {
p = "00" + p;
}
- if (p < 100) {
+ if (p < 100) {
p = "0" + p;
}
return y + "-" + M + "-" + d + " " + h + ":" + m + ":" + s + "," + p;
@@ -54,7 +54,7 @@
// 娓呯悊瀵硅薄null鍊�
function reObject(data) {
for (var obj in data) {
- if (data[obj]===null){
+ if (data[obj] === null) {
delete data[obj];
}
}
@@ -71,26 +71,26 @@
}
// 鏉冮檺
-function limit(child){
- if (child == null){
+function limit(child) {
+ if (child == null) {
child = false;
}
- var param = (child?parent.window:window).location.href.split("?")[1];
+ var param = (child ? parent.window : window).location.href.split("?")[1];
if (null != param) {
var resourceId = param.split("=")[1];
$.ajax({
- url: baseUrl+"/power/menu/"+resourceId+"/auth",
- headers: {'token': localStorage.getItem('token')},
+ url: baseUrl + "/power/menu/" + resourceId + "/auth",
+ headers: { 'token': localStorage.getItem('token') },
method: 'GET',
async: false,
success: function (res) {
- if (res.code === 200){
- for(var i = 0, len = res.data.length; i < len; i++) {
- (child?parent:window).$('#'+res.data[i].code).css("display", "inline-block");
- (child?parent:window).$('.'+res.data[i].code).css("display", "inline-block");
+ if (res.code === 200) {
+ for (var i = 0, len = res.data.length; i < len; i++) {
+ (child ? parent : window).$('#' + res.data[i].code).css("display", "inline-block");
+ (child ? parent : window).$('.' + res.data[i].code).css("display", "inline-block");
}
- } else if (res.code === 403){
- top.location.href = baseUrl+"/";
+ } else if (res.code === 403) {
+ top.location.href = baseUrl + "/";
} else {
layer.msg(res.msg)
}
@@ -113,15 +113,15 @@
url: url,
data: data,
dataType: 'json',
- header: {'token': localStorage.getItem('token')},
+ header: { 'token': localStorage.getItem('token') },
timeout: 10000,
cache: false,
success: function (res) {
- if (res.code === 200){
+ if (res.code === 200) {
callback(res);
- } else if (res.code === 403){
- top.location.href = baseUrl+"/";
- } else {
+ } else if (res.code === 403) {
+ top.location.href = baseUrl + "/";
+ } else {
layer.msg(res.msg);
}
},
@@ -134,9 +134,9 @@
post: function (url, param, callback, type) {
var headerType;
if (type === 'json') {
- headerType = {'Content-Type': 'application/json'}
+ headerType = { 'Content-Type': 'application/json' }
} else {
- headerType = {'Content-Type': 'application/x-www-form-urlencoded'}
+ headerType = { 'Content-Type': 'application/x-www-form-urlencoded' }
}
headerType['token'] = localStorage.getItem('token');
http.toAjax({
@@ -148,11 +148,11 @@
timeout: 10000,
cache: false,
success: function (res) {
- if (res.code === 200){
+ if (res.code === 200) {
callback(res);
- } else if (res.code === 403){
- top.location.href = baseUrl+"/";
- } else {
+ } else if (res.code === 403) {
+ top.location.href = baseUrl + "/";
+ } else {
layer.msg(res.msg);
}
},
@@ -172,126 +172,144 @@
/*************************************************************************************************************/
function arrRemove(arr, key, val) {
- for(var i=arr.length-1; i>=0; i--){
- if(arr[i][key] === val){
- arr.splice(i,1);
+ for (var i = arr.length - 1; i >= 0; i--) {
+ if (arr[i][key] === val) {
+ arr.splice(i, 1);
}
}
}
var matCols = [
- {field: 'matnr', align: 'center',title: '鍟嗗搧缂栧彿锛堝搧鍙凤級', width: 180}
+ { field: 'matnr', align: 'center', title: '鍟嗗搧缂栧彿锛堝搧鍙凤級', width: 180 }
// {field: 'id', align: 'center',title: 'ID'}
// ,{field: 'uuid', align: 'center',title: '缂栧彿'}
- ,{field: 'maktx', align: 'center',title: '鍟嗗搧鍚嶇О锛堝搧鍚嶏級', width: 200}
- ,{field: 'specs', align: 'center',title: '瑙勬牸'}
- ,{field: 'safeQty', align: 'center',title: '褰掗浂闃�鍊�'}
- ,{field: 'model', align: 'center',title: '浠g爜', hide: true}
- ,{field: 'color', align: 'center',title: '棰滆壊', hide: true}
- ,{field: 'brand', align: 'center',title: '鍝佺墝', hide: true}
- ,{field: 'upQty', align: 'center',title: '缁勬墭涓婇檺', hide: true}
- ,{field: 'unit', align: 'center',title: '鍗曚綅', hide: false}
- ,{field: 'price', align: 'center',title: '鍗曚环', hide: true}
- ,{field: 'sku', align: 'center',title: 'sku', hide: true}
- ,{field: 'units', align: 'center',title: '鍗曚綅閲�', hide: true}
- ,{field: 'barcode', align: 'center',title: '鏉$爜', hide: true}
- ,{field: 'origin', align: 'center',title: '浜у湴', hide: true}
- ,{field: 'manu', align: 'center',title: '鍘傚', hide: true}
- ,{field: 'manuDate', align: 'center',title: '鐢熶骇鏃ユ湡', hide: true}
- ,{field: 'itemNum', align: 'center',title: '鍝侀」鏁�', hide: true}
- ,{field: 'weight', align: 'center',title: '鍗曠鍑�閲�', hide: true}
- ,{field: 'length', align: 'center',title: '鍗曠姣涢噸', hide: true}
- ,{field: 'volume', align: 'center',title: '鍗曠浣撶Н', hide: true}
- ,{field: 'threeCode', align: 'center',title: '绠卞瓙灏哄', hide: true}
- ,{field: 'supp', align: 'center',title: '渚涘簲鍟�', hide: true}
- ,{field: 'suppCode', align: 'center',title: '渚涘簲鍟嗙紪鐮�', hide: true}
- ,{field: 'beBatch$', align: 'center',title: '鏄惁鎵规', hide: true}
- ,{field: 'deadTime', align: 'center',title: '淇濊川鏈�', hide: true}
- ,{field: 'deadWarn', align: 'center',title: '棰勮澶╂暟', hide: true}
- ,{field: 'source$', align: 'center',title: '鍒惰喘', hide: true}
- ,{field: 'check$', align: 'center',title: '瑕佹眰妫�楠�', hide: true}
- ,{field: 'danger$', align: 'center',title: '鍗遍櫓鍝�', hide: true}
+ , { field: 'maktx', align: 'center', title: '鍟嗗搧鍚嶇О锛堝搧鍚嶏級', width: 200 }
+ , { field: 'specs', align: 'center', title: '瑙勬牸' }
+ , { field: 'safeQty', align: 'center', title: '褰掗浂闃�鍊�' , templet: function (d) {
+ var raw = d.safeQty;
+ if (raw === null || raw === undefined) return '';
+ if (typeof raw === 'string' && raw.trim() === '') return '';
+ var num = Number(raw);
+ if (!isFinite(num)) return '';
+ return num.toFixed(2);
+ }}
+ , { field: 'model', align: 'center', title: '浠g爜', hide: true }
+ , { field: 'color', align: 'center', title: '棰滆壊', hide: true }
+ , { field: 'brand', align: 'center', title: '鍝佺墝', hide: true }
+ , { field: 'upQty', align: 'center', title: '缁勬墭涓婇檺', hide: true }
+ , { field: 'unit', align: 'center', title: '鍗曚綅', hide: false }
+ , { field: 'price', align: 'center', title: '鍗曚环', hide: true }
+ , { field: 'sku', align: 'center', title: 'sku', hide: true }
+ , { field: 'units', align: 'center', title: '鍗曚綅閲�', hide: true }
+ , { field: 'barcode', align: 'center', title: '鏉$爜', hide: true }
+ , { field: 'origin', align: 'center', title: '浜у湴', hide: true }
+ , { field: 'manu', align: 'center', title: '鍘傚', hide: true }
+ , { field: 'manuDate', align: 'center', title: '鐢熶骇鏃ユ湡', hide: true }
+ , { field: 'itemNum', align: 'center', title: '鍝侀」鏁�', hide: true }
+ , { field: 'weight', align: 'center', title: '鍗曠鍑�閲�', hide: true }
+ , { field: 'length', align: 'center', title: '鍗曠姣涢噸', hide: true }
+ , {
+ field: 'volume', align: 'center', title: 'kg/cm', templet: function (d) {
+ var raw = d.volume;
+ if (raw === null || raw === undefined) return '';
+ if (typeof raw === 'string' && raw.trim() === '') return '';
+ var num = Number(raw);
+ if (!isFinite(num)) return '';
+ return num.toFixed(2);
+ }
+ }
+ , { field: 'threeCode', align: 'center', title: '绠卞瓙灏哄', hide: true }
+ , { field: 'supp', align: 'center', title: '渚涘簲鍟�', hide: true }
+ , { field: 'suppCode', align: 'center', title: '渚涘簲鍟嗙紪鐮�', hide: true }
+ , { field: 'beBatch$', align: 'center', title: '鏄惁鎵规', hide: true }
+ , { field: 'deadTime', align: 'center', title: '淇濊川鏈�', hide: true }
+ , { field: 'deadWarn', align: 'center', title: '棰勮澶╂暟', hide: true }
+ , { field: 'source$', align: 'center', title: '鍒惰喘', hide: true }
+ , { field: 'check$', align: 'center', title: '瑕佹眰妫�楠�', hide: true }
+ , { field: 'danger$', align: 'center', title: '鍗遍櫓鍝�', hide: true }
// ,{field: 'status$', align: 'center',title: '鐘舵��'}
// ,{field: 'createBy$', align: 'center',title: '娣诲姞浜哄憳'}
// ,{field: 'createTime$', align: 'center',title: '娣诲姞鏃堕棿'}
- ,{field: 'updateBy$', align: 'center',title: '淇敼浜哄憳', hide: true}
- ,{field: 'updateTime$', align: 'center',title: '淇敼鏃堕棿', hide: true}
- ,{field: 'memo', align: 'center',title: '澶囨敞', hide: true}
-
+ , { field: 'updateBy$', align: 'center', title: '淇敼浜哄憳', hide: true }
+ , { field: 'updateTime$', align: 'center', title: '淇敼鏃堕棿', hide: true }
+ , { field: 'memo', align: 'center', title: '澶囨敞', hide: true }
]
var cacheCols = [
- {field: 'matnr', align: 'center',title: '鍟嗗搧缂栧彿锛堝搧鍙凤級', sort:true}
- ,{field: 'maktx', align: 'center',title: '鍟嗗搧鍚嶇О锛堝搧鍚嶏級', sort:true}
- ,{field: 'anfme', align: 'center',title: '鏁伴噺', hide: false}
- ,{field: 'specs', align: 'center',title: '瑙勬牸', hide: false}
- ,{field: 'model', align: 'center',title: '浠g爜', hide: true}
- ,{field: 'color', align: 'center',title: '棰滆壊', hide: true}
- ,{field: 'brand', align: 'center',title: '鍝佺墝', hide: true}
- ,{field: 'unit', align: 'center',title: '鍗曚綅', hide: false}
- ,{field: 'batch', align: 'center',title: '璐у搧鐗瑰緛', sort:true}
- ,{field: 'frozen$', align: 'center',title: '鍐荤粨鍚�',hide: true,
- templet: function(d) {
+ { field: 'matnr', align: 'center', title: '鍟嗗搧缂栧彿锛堝搧鍙凤級', sort: true }
+ , { field: 'maktx', align: 'center', title: '鍟嗗搧鍚嶇О锛堝搧鍚嶏級', sort: true }
+ , { field: 'anfme', align: 'center', title: '鏁伴噺', hide: false }
+ , { field: 'specs', align: 'center', title: '瑙勬牸', hide: false }
+ , { field: 'model', align: 'center', title: '浠g爜', hide: true }
+ , { field: 'color', align: 'center', title: '棰滆壊', hide: true }
+ , { field: 'brand', align: 'center', title: '鍝佺墝', hide: true }
+ , { field: 'unit', align: 'center', title: '鍗曚綅', hide: false }
+ , { field: 'batch', align: 'center', title: '璐у搧鐗瑰緛', sort: true }
+ , {
+ field: 'frozen$', align: 'center', title: '鍐荤粨鍚�', hide: true,
+ templet: function (d) {
// 鏍规嵁鏉′欢鍒ゆ柇瀛椾綋棰滆壊
if (d.frozen$ === '宸插喕缁�') {
- return '<span style="color: #34a8de;">' +d.frozen$ + '</span>';
+ return '<span style="color: #34a8de;">' + d.frozen$ + '</span>';
} else {
- return '<span">' +d.frozen$ + '</span>';
+ return '<span">' + d.frozen$ + '</span>';
}
- }}
+ }
+ }
]
var detlCols = [
- {field: 'matnr', align: 'center',title: '鍟嗗搧缂栧彿锛堝搧鍙凤級', sort:true}
- ,{field: 'maktx', align: 'center',title: '鍟嗗搧鍚嶇О锛堝搧鍚嶏級', sort:true}
- ,{field: 'orderNo', align: 'center',title: '鍗曟嵁缂栧彿', hide: false}
- ,{field: 'batch', align: 'center',title: '璐у搧鐗瑰緛', sort:true}
- ,{field: 'anfme', align: 'center',title: '鏁伴噺', hide: false}
- ,{field: 'zpallet', align: 'center',title: '鎵樼洏鏉$爜', hide: false}
- ,{field: 'specs', align: 'center',title: '瑙勬牸', hide: false}
- ,{field: 'model', align: 'center',title: '浠g爜', hide: true}
- ,{field: 'color', align: 'center',title: '棰滆壊', hide: true}
- ,{field: 'brand', align: 'center',title: '鍝佺墝', hide: true}
- ,{field: 'unit', align: 'center',title: '鍗曚綅', hide: false}
- ,{field: 'price', align: 'center',title: '鍗曚环', hide: true}
- ,{field: 'sku', align: 'center',title: 'sku', hide: true}
- ,{field: 'units', align: 'center',title: '鍗曚綅閲�', hide: true}
- ,{field: 'barcode', align: 'center',title: '鏉$爜', hide: true}
- ,{field: 'origin', align: 'center',title: '浜у湴', hide: true}
- ,{field: 'manu', align: 'center',title: '鍘傚', hide: true}
- ,{field: 'manuDate', align: 'center',title: '鐢熶骇鏃ユ湡', hide: true}
- ,{field: 'itemNum', align: 'center',title: '鍝侀」鏁�', hide: true}
- ,{field: 'safeQty', align: 'center',title: '瀹夊叏搴撳瓨閲�', hide: true}
- ,{field: 'weight', align: 'center',title: '鍗曠鍑�閲�', hide: true}
- ,{field: 'length', align: 'center',title: '鍗曠姣涢噸', hide: true}
- ,{field: 'volume', align: 'center',title: '鍗曠浣撶Н', hide: true}
- ,{field: 'threeCode', align: 'center',title: '绠卞瓙灏哄', hide: true}
- ,{field: 'supp', align: 'center',title: '渚涘簲鍟�', hide: true}
- ,{field: 'suppCode', align: 'center',title: '渚涘簲鍟嗙紪鐮�', hide: true}
- ,{field: 'beBatch$', align: 'center',title: '鏄惁鎵规', hide: true}
- ,{field: 'deadTime', align: 'center',title: '淇濊川鏈�', hide: true}
- ,{field: 'deadWarn', align: 'center',title: '棰勮澶╂暟', hide: true}
- ,{field: 'source$', align: 'center',title: '鍒惰喘', hide: true}
- ,{field: 'check$', align: 'center',title: '瑕佹眰妫�楠�', hide: true}
- ,{field: 'danger$', align: 'center',title: '鍗遍櫓鍝�', hide: true}
- ,{field: 'frozen$', align: 'center',title: '鍐荤粨鍚�',hide: true,
- templet: function(d) {
+ { field: 'matnr', align: 'center', title: '鍟嗗搧缂栧彿锛堝搧鍙凤級', sort: true }
+ , { field: 'maktx', align: 'center', title: '鍟嗗搧鍚嶇О锛堝搧鍚嶏級', sort: true }
+ , { field: 'orderNo', align: 'center', title: '鍗曟嵁缂栧彿', hide: false }
+ , { field: 'batch', align: 'center', title: '璐у搧鐗瑰緛', sort: true }
+ , { field: 'anfme', align: 'center', title: '鏁伴噺', hide: false }
+ , { field: 'zpallet', align: 'center', title: '鎵樼洏鏉$爜', hide: false }
+ , { field: 'specs', align: 'center', title: '瑙勬牸', hide: false }
+ , { field: 'model', align: 'center', title: '浠g爜', hide: true }
+ , { field: 'color', align: 'center', title: '棰滆壊', hide: true }
+ , { field: 'brand', align: 'center', title: '鍝佺墝', hide: true }
+ , { field: 'unit', align: 'center', title: '鍗曚綅', hide: false }
+ , { field: 'price', align: 'center', title: '鍗曚环', hide: true }
+ , { field: 'sku', align: 'center', title: 'sku', hide: true }
+ , { field: 'units', align: 'center', title: '鍗曚綅閲�', hide: true }
+ , { field: 'barcode', align: 'center', title: '鏉$爜', hide: true }
+ , { field: 'origin', align: 'center', title: '浜у湴', hide: true }
+ , { field: 'manu', align: 'center', title: '鍘傚', hide: true }
+ , { field: 'manuDate', align: 'center', title: '鐢熶骇鏃ユ湡', hide: true }
+ , { field: 'itemNum', align: 'center', title: '鍝侀」鏁�', hide: true }
+ , { field: 'safeQty', align: 'center', title: '瀹夊叏搴撳瓨閲�', hide: true }
+ , { field: 'weight', align: 'center', title: '鍗曠鍑�閲�', hide: true }
+ , { field: 'length', align: 'center', title: '鍗曠姣涢噸', hide: true }
+ , { field: 'volume', align: 'center', title: '鍗曠浣撶Н', hide: true }
+ , { field: 'threeCode', align: 'center', title: '绠卞瓙灏哄', hide: true }
+ , { field: 'supp', align: 'center', title: '渚涘簲鍟�', hide: true }
+ , { field: 'suppCode', align: 'center', title: '渚涘簲鍟嗙紪鐮�', hide: true }
+ , { field: 'beBatch$', align: 'center', title: '鏄惁鎵规', hide: true }
+ , { field: 'deadTime', align: 'center', title: '淇濊川鏈�', hide: true }
+ , { field: 'deadWarn', align: 'center', title: '棰勮澶╂暟', hide: true }
+ , { field: 'source$', align: 'center', title: '鍒惰喘', hide: true }
+ , { field: 'check$', align: 'center', title: '瑕佹眰妫�楠�', hide: true }
+ , { field: 'danger$', align: 'center', title: '鍗遍櫓鍝�', hide: true }
+ , {
+ field: 'frozen$', align: 'center', title: '鍐荤粨鍚�', hide: true,
+ templet: function (d) {
// 鏍规嵁鏉′欢鍒ゆ柇瀛椾綋棰滆壊
if (d.frozen$ === '宸插喕缁�') {
- return '<span style="color: #34a8de;">' +d.frozen$ + '</span>';
+ return '<span style="color: #34a8de;">' + d.frozen$ + '</span>';
} else {
- return '<span">' +d.frozen$ + '</span>';
+ return '<span">' + d.frozen$ + '</span>';
}
- }}
+ }
+ }
]
-function getQueryVariable(variable)
-{
+function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split("&");
- for (var i=0;i<vars.length;i++) {
+ for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split("=");
- if(pair[0] == variable){return pair[1];}
+ if (pair[0] == variable) { return pair[1]; }
}
- return(false);
+ return (false);
}
diff --git a/src/main/webapp/static/js/order/order.js b/src/main/webapp/static/js/order/order.js
index 6345ea7..d9c3822 100644
--- a/src/main/webapp/static/js/order/order.js
+++ b/src/main/webapp/static/js/order/order.js
@@ -1,4 +1,5 @@
var insTbCount = 0;
+var admin;
layui.config({
base: baseUrl + "/static/layui/lay/modules/"
}).use(['layer', 'form', 'table', 'util', 'admin', 'xmSelect', 'laydate'], function () {
@@ -7,28 +8,28 @@
var form = layui.form;
var table = layui.table;
var util = layui.util;
- var admin = layui.admin;
+ admin = layui.admin;
var xmSelect = layui.xmSelect;
var layDate = layui.laydate;
var laytpl = layui.laytpl;
// 娓叉煋鎼滅储妯℃澘
$.ajax({
- url: baseUrl+"/docType/list/auth",
- headers: {'token': localStorage.getItem('token')},
+ url: baseUrl + "/docType/list/auth",
+ headers: { 'token': localStorage.getItem('token') },
data: {
limit: 9999
},
method: 'POST',
success: function (res) {
- if (res.code === 200){
+ if (res.code === 200) {
let template = Handlebars.compile($('#docTypeTpl').html());
$('#docType-query').html(template(res.data));
layui.form.render('select');
- } else if (res.code === 403){
- top.location.href = baseUrl+"/";
+ } else if (res.code === 403) {
+ top.location.href = baseUrl + "/";
} else {
- layer.msg(res.msg, {icon: 2})
+ layer.msg(res.msg, { icon: 2 })
}
}
})
@@ -36,19 +37,20 @@
// 娓叉煋琛ㄦ牸
var insTb = table.render({
elem: '#order',
- url: baseUrl+'/order/head/page/auth',
- headers: {token: localStorage.getItem('token')},
+ url: baseUrl + '/order/head/page/auth',
+ headers: { token: localStorage.getItem('token') },
page: true,
+ toolbar: '#toolbar',
cellMinWidth: 100,
cols: [[
- {type: 'numbers'},
- {field: 'orderNo', title: '鍗曟嵁缂栧彿', templet: '#orderNoTpl'},
- {field: 'docType$', align: 'center', title: '绫诲瀷', minWidth: 160, width: 160},
- {align: 'center', title: '鏄庣粏', toolbar: '#tbLook', minWidth: 160, width: 160},
- {field: 'createTime$', title: '鍒涘缓鏃堕棿', minWidth: 200, width: 200},
- {field: 'settle$', align: 'center', title: '鐘舵��', templet: '#settleTpl', minWidth: 160, width: 160},
- {field: 'memo', align: 'center',title: '澶囨敞', hide: true},
- {align: 'center', title: '鎿嶄綔', toolbar: '#operate', width: 180}
+ { type: 'numbers' },
+ { field: 'orderNo', title: '鍗曟嵁缂栧彿', templet: '#orderNoTpl' },
+ { field: 'docType$', align: 'center', title: '绫诲瀷', minWidth: 160, width: 160 },
+ { align: 'center', title: '鏄庣粏', toolbar: '#tbLook', minWidth: 160, width: 160 },
+ { field: 'createTime$', title: '鍒涘缓鏃堕棿', minWidth: 200, width: 200 },
+ { field: 'settle$', align: 'center', title: '鐘舵��', templet: '#settleTpl', minWidth: 160, width: 160 },
+ { field: 'memo', align: 'center', title: '澶囨敞', hide: true },
+ { align: 'center', title: '鎿嶄綔', toolbar: '#operate', width: 180 }
]],
request: {
pageName: 'curr',
@@ -68,7 +70,7 @@
done: function (res, curr, count) {
limit();
if (res.code === 403) {
- top.location.href = baseUrl+"/";
+ top.location.href = baseUrl + "/";
}
insTbCount = count;
}
@@ -76,7 +78,7 @@
// 鎼滅储
form.on('submit(tbSearch)', function (data) {
- insTb.reload({where: data.field, page: {curr: 1}});
+ insTb.reload({ where: data.field, page: { curr: 1 } });
});
// 娣诲姞
@@ -113,22 +115,22 @@
success: function (layero) {
table.render({
elem: '#lookSSXMTable',
- headers: {token: localStorage.getItem('token')},
- url: baseUrl+'/orderDetl/list/auth',
+ headers: { token: localStorage.getItem('token') },
+ url: baseUrl + '/orderDetl/list/auth',
where: {
order_id: data.id
},
page: true,
cellMinWidth: 100,
cols: [[
- {type: 'numbers'},
- {field: 'matnr', title: '鍟嗗搧缂栫爜', width: 160},
- {field: 'maktx', title: '鍟嗗搧鍚嶇О', width: 160},
- {field: 'specs', title: '瑙勬牸'},
- {field: 'batch', title: '鎵瑰彿'},
- {field: 'anfme', title: '寰呭畬缁撴暟閲�'},
- {field: 'qty', title: '寰呬笂鎶ユ暟閲�', style: 'font-weight: bold'},
- {field: 'workQty', title: '宸蹭笂鎶ユ暟閲�'},
+ { type: 'numbers' },
+ { field: 'matnr', title: '鍟嗗搧缂栫爜', width: 160 },
+ { field: 'maktx', title: '鍟嗗搧鍚嶇О', width: 160 },
+ { field: 'specs', title: '瑙勬牸' },
+ { field: 'batch', title: '鎵瑰彿' },
+ { field: 'anfme', title: '寰呭畬缁撴暟閲�' },
+ { field: 'qty', title: '寰呬笂鎶ユ暟閲�', style: 'font-weight: bold' },
+ { field: 'workQty', title: '宸蹭笂鎶ユ暟閲�' },
// {field: 'unit', title: '鍗曚綅'},
// {
// field: 'createTime$', title: '鍒涘缓鏃堕棿', sort: true, templet: function (d) {
@@ -182,42 +184,42 @@
form.on('submit(orderEditSubmit)', function (data) {
// 缁勮鏁版嵁
if (xxDataList.length <= 0) {
- layer.tips('璇锋坊鍔犲崟鎹槑缁�', '#matAddBtnComment', {tips: [1, '#ff4c4c']});
+ layer.tips('璇锋坊鍔犲崟鎹槑缁�', '#matAddBtnComment', { tips: [1, '#ff4c4c'] });
return false;
}
let nList = admin.util.deepClone(xxDataList);
for (let xi = 0; xi < nList.length; xi++) {
- if (nList[xi].anfme <= 0){
- layer.msg('鏄庣粏淇敼鏁伴噺涓嶅悎娉�', {icon: 2});
+ if (nList[xi].anfme <= 0) {
+ layer.msg('鏄庣粏淇敼鏁伴噺涓嶅悎娉�', { icon: 2 });
return false;
}
- if (nList[xi].anfme < nList[xi].workQty){
- layer.msg('鏁伴噺涓嶈兘灏忎簬宸蹭綔涓氭暟閲�', {icon: 2});
+ if (nList[xi].anfme < nList[xi].workQty) {
+ layer.msg('鏁伴噺涓嶈兘灏忎簬宸蹭綔涓氭暟閲�', { icon: 2 });
return false;
}
}
layer.load(2);
$.ajax({
- url: baseUrl+"/order/form/" + (isExpAdd?"add":"modify") + "/auth",
- headers: {'token': localStorage.getItem('token')},
+ url: baseUrl + "/order/form/" + (isExpAdd ? "add" : "modify") + "/auth",
+ headers: { 'token': localStorage.getItem('token') },
data: JSON.stringify({
orderId: Number(data.field.id),
docType: Number(data.field.docType),
orderNo: data.field.orderNo,
orderDetlList: nList
}),
- contentType:'application/json;charset=UTF-8',
+ contentType: 'application/json;charset=UTF-8',
method: 'POST',
success: function (res) {
layer.closeAll('loading');
- if (res.code === 200){
+ if (res.code === 200) {
layer.close(dIndex);
$(".layui-laypage-btn")[0].click();
- layer.msg(res.msg, {icon: 1});
- } else if (res.code === 403){
- top.location.href = baseUrl+"/";
- }else {
- layer.msg(res.msg, {icon: 2});
+ layer.msg(res.msg, { icon: 1 });
+ } else if (res.code === 403) {
+ top.location.href = baseUrl + "/";
+ } else {
+ layer.msg(res.msg, { icon: 2 });
}
}
})
@@ -227,22 +229,22 @@
var xxDataList = [];
var tbOptions = {
elem: '#formSSXMTable',
- headers: {token: localStorage.getItem('token')},
+ headers: { token: localStorage.getItem('token') },
data: xxDataList,
page: true,
height: '350px;',
cellMinWidth: 100,
cols: [[
- {type: 'numbers', title: '#'},
- {field: 'matnr', title: '鍟嗗搧缂栫爜', width: 160},
- {field: 'maktx', title: '鍟嗗搧鍚嶇О', width: 200},
- {field: 'batch', title: '鎵瑰彿', edit: true},
- {field: 'specs', title: '瑙勬牸'},
- {field: 'anfme', title: '鏁伴噺(淇敼)', style: 'color: blue;font-weight: bold', edit: true, minWidth: 110, width: 110},
- {field: 'workQty', title: '浣滀笟鏁伴噺', minWidth: 100, width: 100},
+ { type: 'numbers', title: '#' },
+ { field: 'matnr', title: '鍟嗗搧缂栫爜', width: 160 },
+ { field: 'maktx', title: '鍟嗗搧鍚嶇О', width: 200 },
+ { field: 'batch', title: '鎵瑰彿', edit: true },
+ { field: 'specs', title: '瑙勬牸' },
+ { field: 'anfme', title: '鏁伴噺(淇敼)', style: 'color: blue;font-weight: bold', edit: true, minWidth: 110, width: 110 },
+ { field: 'workQty', title: '浣滀笟鏁伴噺', minWidth: 100, width: 100 },
// {field: 'unit', title: '鍗曚綅', width: 80},
- {field: 'memo', title: '澶囨敞' , edit: true},
- {align: 'center', title: '鎿嶄綔', toolbar: '#formSSXMTableBar', minWidth: 80, width: 80, fixed: 'right'}
+ { field: 'memo', title: '澶囨敞', edit: true },
+ { align: 'center', title: '鎿嶄綔', toolbar: '#formSSXMTableBar', minWidth: 80, width: 80, fixed: 'right' }
]],
done: function (res) {
$(layero).find('.layui-table-view').css('margin', '0');
@@ -251,18 +253,18 @@
};
if (!isExpAdd) {
$.ajax({
- url: baseUrl+"/order/detl/all/auth?orderId=" + expTpe.id,
- headers: {'token': localStorage.getItem('token')},
+ url: baseUrl + "/order/detl/all/auth?orderId=" + expTpe.id,
+ headers: { 'token': localStorage.getItem('token') },
method: 'GET',
async: false,
success: function (res) {
- if (res.code === 200){
+ if (res.code === 200) {
xxDataList = res.data;
tbOptions.data = xxDataList;
- } else if (res.code === 403){
- top.location.href = baseUrl+"/";
- }else {
- layer.msg(res.msg, {icon: 2})
+ } else if (res.code === 403) {
+ top.location.href = baseUrl + "/";
+ } else {
+ layer.msg(res.msg, { icon: 2 })
}
}
})
@@ -275,8 +277,8 @@
if (layEvent === 'edit') {
showEditModel2(data);
} else if (layEvent === 'del') {
- if(data.workQty > 0){
- layer.msg("宸插瓨鍦ㄤ綔涓氭暟閲忥紝涓嶈兘鍒犻櫎", {icon: 2});
+ if (data.workQty > 0) {
+ layer.msg("宸插瓨鍦ㄤ綔涓氭暟閲忥紝涓嶈兘鍒犻櫎", { icon: 2 });
return;
}
layer.confirm('纭畾瑕佸垹闄ゅ悧锛�', {
@@ -290,7 +292,7 @@
break;
}
}
- insTbSSXM.reload({data: xxDataList, page: {curr: 1}});
+ insTbSSXM.reload({ data: xxDataList, page: { curr: 1 } });
});
}
});
@@ -298,20 +300,20 @@
table.on('edit(formSSXMTable)', function (obj) {
let index = obj.tr.attr("data-index");
let data = xxDataList[index];
- if (obj.field === 'anfme'){
+ if (obj.field === 'anfme') {
let vle = Number(obj.value);
if (isNaN(vle)) {
- layer.msg("璇疯緭鍏ユ暟瀛�", {icon: 2});
+ layer.msg("璇疯緭鍏ユ暟瀛�", { icon: 2 });
return false;
} else {
if (vle <= 0) {
- layer.msg("鏁伴噺蹇呴』澶т簬闆�", {icon: 2});
+ layer.msg("鏁伴噺蹇呴』澶т簬闆�", { icon: 2 });
// data[obj.field] = 0;
// insTbSSXM.reload({data: xxDataList});
return false;
}
- if(obj.value < data.workQty){
- layer.msg("杈撳叆鏁伴噺涓嶈兘灏忎簬浣滀笟涓暟閲�", {icon: 2});
+ if (obj.value < data.workQty) {
+ layer.msg("杈撳叆鏁伴噺涓嶈兘灏忎簬浣滀笟涓暟閲�", { icon: 2 });
// data[obj.field] = 0;
// insTbSSXM.reload({data: xxDataList});
return false;
@@ -319,7 +321,7 @@
}
}
data[obj.field] = obj.value;
- insTbSSXM.reload({data: xxDataList});
+ insTbSSXM.reload({ data: xxDataList });
});
$('#matAddBtnComment').click(function () {
@@ -340,22 +342,22 @@
// 琛ㄥ崟鎻愪氦浜嬩欢
form.on('submit(matEditSubmit)', function (data) {
let selectList = matXmSelect.getValue();
- for (let i = 0; i<selectList.length; i++) {
+ for (let i = 0; i < selectList.length; i++) {
let item = selectList[i];
// 鏌ヨ鐗╂枡璇︽儏
$.ajax({
- url: baseUrl+"/mat/covert/"+item.value+"/auth",
- headers: {'token': localStorage.getItem('token')},
+ url: baseUrl + "/mat/covert/" + item.value + "/auth",
+ headers: { 'token': localStorage.getItem('token') },
method: 'GET',
async: false,
success: function (res) {
- if (res.code === 200){
+ if (res.code === 200) {
xxDataList.push(res.data);
- insTbSSXM.reload({data: xxDataList, page: {curr: 1}});
- } else if (res.code === 403){
- top.location.href = baseUrl+"/";
- }else {
- layer.msg(res.msg, {icon: 2})
+ insTbSSXM.reload({ data: xxDataList, page: { curr: 1 } });
+ } else if (res.code === 403) {
+ top.location.href = baseUrl + "/";
+ } else {
+ layer.msg(res.msg, { icon: 2 })
}
}
})
@@ -373,20 +375,20 @@
toolbar: { show: true },
filterable: true,
remoteSearch: true,
- remoteMethod: function(val, cb, show){
+ remoteMethod: function (val, cb, show) {
$.ajax({
- url: baseUrl+"/mat/all/get/kv",
- headers: {'token': localStorage.getItem('token')},
+ url: baseUrl + "/mat/all/get/kv",
+ headers: { 'token': localStorage.getItem('token') },
data: {
condition: val
},
method: 'POST',
success: function (res) {
- if (res.code === 200){
+ if (res.code === 200) {
cb(res.data)
} else {
cb([]);
- layer.msg(res.msg, {icon: 2});
+ layer.msg(res.msg, { icon: 2 });
}
}
});
@@ -412,25 +414,25 @@
layer.close(i);
layer.load(2);
$.ajax({
- url: baseUrl+"/order/delete/auth",
- headers: {'token': localStorage.getItem('token')},
+ url: baseUrl + "/order/delete/auth",
+ headers: { 'token': localStorage.getItem('token') },
data: {
orderId: orderId
},
method: 'POST',
success: function (res) {
layer.closeAll('loading');
- if (res.code === 200){
+ if (res.code === 200) {
if (insTbCount === 0) {
- insTb.reload({page: {curr: 1}});
+ insTb.reload({ page: { curr: 1 } });
} else {
$(".layui-laypage-btn")[0].click();
}
- layer.msg(res.msg, {icon: 1});
- } else if (res.code === 403){
- top.location.href = baseUrl+"/";
- }else {
- layer.msg(res.msg, {icon: 2});
+ layer.msg(res.msg, { icon: 1 });
+ } else if (res.code === 403) {
+ top.location.href = baseUrl + "/";
+ } else {
+ layer.msg(res.msg, { icon: 2 });
}
}
})
@@ -448,8 +450,8 @@
console.log(orderId);
console.log(settle);
$.ajax({
- url: baseUrl+"/order/update/auth",
- headers: {'token': localStorage.getItem('token')},
+ url: baseUrl + "/order/update/auth",
+ headers: { 'token': localStorage.getItem('token') },
data: {
id: orderId,
orderNo: orderNo,
@@ -458,17 +460,17 @@
method: 'POST',
success: function (res) {
layer.closeAll('loading');
- if (res.code === 200){
+ if (res.code === 200) {
if (insTbCount === 0) {
- insTb.reload({page: {curr: 1}});
+ insTb.reload({ page: { curr: 1 } });
} else {
$(".layui-laypage-btn")[0].click();
}
- layer.msg(res.msg, {icon: 1});
- } else if (res.code === 403){
- top.location.href = baseUrl+"/";
- }else {
- layer.msg(res.msg, {icon: 2});
+ layer.msg(res.msg, { icon: 1 });
+ } else if (res.code === 403) {
+ top.location.href = baseUrl + "/";
+ } else {
+ layer.msg(res.msg, { icon: 2 });
}
}
})
@@ -477,17 +479,17 @@
// 浠诲姟杩芥函
function showWrkTrace(orderId) {
- let loadIndex = layer.msg('璇锋眰涓�...', {icon: 16, shade: 0.01, time: false});
+ let loadIndex = layer.msg('璇锋眰涓�...', { icon: 16, shade: 0.01, time: false });
$.ajax({
- url: baseUrl+"/order/wrk/trace/auth",
- headers: {'token': localStorage.getItem('token')},
+ url: baseUrl + "/order/wrk/trace/auth",
+ headers: { 'token': localStorage.getItem('token') },
data: {
orderId: orderId
},
method: 'POST',
success: function (res) {
layer.close(loadIndex);
- if (res.code === 200){
+ if (res.code === 200) {
laytpl(wrkTraceDialog.innerHTML).render(res.data, function (html) {
admin.open({
type: 1,
@@ -502,26 +504,26 @@
var traceOptions = {
title: {
text: '浣滀笟/瀹岀粨/涓婃姤', x: 'center', y: '38%',
- textStyle: {fontSize: 18, color: '#262626', fontWeight: 'normal'},
- subtextStyle: {fontSize: 36, color: '#10B4E8'},
+ textStyle: { fontSize: 18, color: '#262626', fontWeight: 'normal' },
+ subtextStyle: { fontSize: 36, color: '#10B4E8' },
itemGap: 20
},
color: ['#10B4E8', '#E0E0E0', '#FF0000'],
- tooltip: {trigger: 'item'},
- series: [{name: '鏁伴噺', type: 'pie', radius: ['75%', '80%'], label: {normal: {show: false}}}]
+ tooltip: { trigger: 'item' },
+ series: [{ name: '鏁伴噺', type: 'pie', radius: ['75%', '80%'], label: { normal: { show: false } } }]
};
traceCharts.setOption(traceOptions);
// 璧嬪��
traceCharts.setOption({
title: {
- subtext: res.data.totalQty+"/"+res.data.wrkQty+"/"+res.data.endQty
+ subtext: res.data.totalQty + "/" + res.data.wrkQty + "/" + res.data.endQty
},
series: [
{
data: [
- {name: '宸蹭綔涓�', value: res.data.wrkQty},
- {name: '鏈綔涓�', value: res.data.totalQty-res.data.wrkQty-res.data.lackQty},
- {name: '搴撳瓨涓嶈冻', value: res.data.lackQty},
+ { name: '宸蹭綔涓�', value: res.data.wrkQty },
+ { name: '鏈綔涓�', value: res.data.totalQty - res.data.wrkQty - res.data.lackQty },
+ { name: '搴撳瓨涓嶈冻', value: res.data.lackQty },
]
}
]
@@ -529,10 +531,10 @@
}
});
});
- } else if (res.code === 403){
- top.location.href = baseUrl+"/";
- }else {
- layer.msg(res.msg, {icon: 2});
+ } else if (res.code === 403) {
+ top.location.href = baseUrl + "/";
+ } else {
+ layer.msg(res.msg, { icon: 2 });
}
}
})
@@ -540,7 +542,77 @@
layDate.render({
elem: '.layui-laydate-range'
- ,type: 'datetime'
- ,range: true
+ , type: 'datetime'
+ , range: true
});
});
+
+// excel瀵煎叆妯℃澘涓嬭浇
+function excelMouldDownload() {
+ layer.load(1, { shade: [0.1, '#fff'] });
+ location.href = baseUrl + "/orders/excel/import/mould";
+ layer.closeAll('loading');
+}
+
+// excel瀵煎叆
+function importExcel() {
+ $("#importExcel").trigger("click");
+}
+
+// excel瀵煎叆妯℃澘涓嬭浇
+function excelMouldDownload() {
+ layer.load(1, {shade: [0.1, '#fff']});
+ location.href = baseUrl + "/mat/excel/import/mould";
+ layer.closeAll('loading');
+}
+
+// excel瀵煎叆
+function importExcel() {
+ $("#importExcel").trigger("click");
+}
+
+function upload(obj) {
+ if (!obj.files) {
+ return;
+ }
+ var file = obj.files[0];
+ admin.confirm('纭鍚屾 [' + file.name + '] 鏂囦欢鍚楋紵', function (index) {
+ layer.load(1, {shade: [0.1, '#fff']});
+ var url = baseUrl + "/orders/excel/import/auth";
+ var form = new FormData();
+ form.append("file", file);
+ xhr = new XMLHttpRequest();
+ xhr.open("post", url, true); //post鏂瑰紡锛寀rl涓烘湇鍔″櫒璇锋眰鍦板潃锛宼rue 璇ュ弬鏁拌瀹氳姹傛槸鍚﹀紓姝ュ鐞嗐��
+ xhr.setRequestHeader('token', localStorage.getItem('token'));
+ xhr.onload = uploadComplete; //璇锋眰瀹屾垚
+ xhr.onerror = uploadFailed; //璇锋眰澶辫触
+ xhr.onloadend = function () { // // 涓婁紶瀹屾垚閲嶇疆鏂囦欢娴�
+ layer.closeAll('loading');
+ $("#importExcel").val("");
+ };
+ // xhr.upload.onprogress = progressFunction;//銆愪笂浼犺繘搴﹁皟鐢ㄦ柟娉曞疄鐜般��
+ xhr.upload.onloadstart = function () {//涓婁紶寮�濮嬫墽琛屾柟娉�
+ ot = new Date().getTime(); //璁剧疆涓婁紶寮�濮嬫椂闂�
+ oloaded = 0;//璁剧疆涓婁紶寮�濮嬫椂锛屼互涓婁紶鐨勬枃浠跺ぇ灏忎负0
+ };
+ xhr.send(form);
+ }, function (index) {
+ $("#importExcel").val("");
+ });
+}
+
+function uploadComplete(evt) {
+ var res = JSON.parse(evt.target.responseText);
+ if (res.code === 200) {
+ layer.msg(res.msg, {icon: 1});
+ loadTree("");
+ } else {
+ layer.msg(res.msg, {icon: 2});
+ }
+}
+
+function uploadFailed(evt) {
+ var res = JSON.parse(evt.target.responseText);
+ layer.msg(res.msg, {icon: 2});
+}
+
diff --git a/src/main/webapp/views/order/order.html b/src/main/webapp/views/order/order.html
index 3e88192..1d80dbc 100644
--- a/src/main/webapp/views/order/order.html
+++ b/src/main/webapp/views/order/order.html
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<html lang="en">
+
<head>
<meta charset="utf-8">
<title></title>
@@ -25,77 +26,100 @@
.layui-timeline:first-child .layui-timeline-item {
margin-top: 30px;
}
+
.btn-add {
display: none;
}
+
.btn-edit {
display: none;
}
+
.btn-complete {
display: none;
}
+
.btn-delete {
display: none;
}
</style>
</head>
-<body>
-<!-- 姝f枃寮�濮� -->
-<div class="layui-fluid">
- <div class="layui-card">
- <div class="layui-card-body">
- <!-- 琛ㄦ牸椤堕儴宸ュ叿鏍� -->
- <div class="layui-form toolbar">
- <div class="layui-form-item">
- <div class="layui-inline">
- <div class="layui-input-inline mr0">
- <input name="order_no" class="layui-input" type="text" placeholder="杈撳叆鍗曟嵁缂栧彿"/>
+<body>
+ <!-- 姝f枃寮�濮� -->
+ <div class="layui-fluid">
+ <div class="layui-card">
+ <div class="layui-card-body">
+ <!-- 琛ㄦ牸椤堕儴宸ュ叿鏍� -->
+ <div class="layui-form toolbar">
+ <div class="layui-form-item">
+ <div class="layui-inline">
+ <div class="layui-input-inline mr0">
+ <input name="order_no" class="layui-input" type="text" placeholder="杈撳叆鍗曟嵁缂栧彿" />
+ </div>
</div>
- </div>
- <div class="layui-inline" style="width: 300px">
- <div class="layui-input-inline">
- <input class="layui-input layui-laydate-range" name="create_time" type="text" placeholder="璧峰鏃堕棿 - 缁堟鏃堕棿" autocomplete="off" style="width: 300px">
+ <div class="layui-inline" style="width: 300px">
+ <div class="layui-input-inline">
+ <input class="layui-input layui-laydate-range" name="create_time" type="text"
+ placeholder="璧峰鏃堕棿 - 缁堟鏃堕棿" autocomplete="off" style="width: 300px">
+ </div>
</div>
- </div>
- <div class="layui-inline">
- <div class="layui-input-inline">
- <select name="doc_type" id="docType-query">
- </select>
+ <div class="layui-inline">
+ <div class="layui-input-inline">
+ <select name="doc_type" id="docType-query">
+ </select>
+ </div>
</div>
- </div>
- <div class="layui-inline">
- <div class="layui-input-inline">
- <select name="settle">
- <option value="">閫夋嫨鐘舵��</option>
- <option value="1">寰呭鐞�</option>
- <option value="2">浣滀笟涓�</option>
- <option value="4">宸插畬鎴�</option>
- <option value="6">涓婃姤瀹屾垚</option>
- </select>
+ <div class="layui-inline">
+ <div class="layui-input-inline">
+ <select name="settle">
+ <option value="">閫夋嫨鐘舵��</option>
+ <option value="1">寰呭鐞�</option>
+ <option value="2">浣滀笟涓�</option>
+ <option value="4">宸插畬鎴�</option>
+ <option value="6">涓婃姤瀹屾垚</option>
+ </select>
+ </div>
</div>
- </div>
- <div class="layui-inline">
- <button class="layui-btn icon-btn" lay-filter="tbSearch" lay-submit>
- <i class="layui-icon"></i>鎼滅储
- </button>
- <button id="orderAddBtn" class="layui-btn icon-btn btn-add"><i class="layui-icon"></i>娣诲姞
- </button>
+ <div class="layui-inline">
+ <button class="layui-btn icon-btn" lay-filter="tbSearch" lay-submit>
+ <i class="layui-icon"></i>鎼滅储
+ </button>
+ <button id="orderAddBtn" class="layui-btn icon-btn btn-add"><i
+ class="layui-icon"></i>娣诲姞
+ </button>
+ </div>
</div>
</div>
+ <table id="order" lay-filter="order"></table>
</div>
- <table id="order" lay-filter="order"></table>
+ </div>
+ <div class="layui-card">
+ <div class="layui-card-body">
+ 鍏ュ簱閫氱煡鍗曪細鐢盓RP鎻愪緵鍗曟嵁缂栧彿銆佺被鍨嬨�佸崟鎹椂闂村強鐗╂枡鏄庣粏锛岀敓鎴愬叆搴撲綔涓氬崟锛屼负缁存姢绯荤粺楂樺彲鐢紝鐢ㄦ埛鍙嚜琛屾坊鍔犲叆搴撻�氱煡鍗曟暟鎹紝瀹屾垚鐙珛鐨勫叆搴撲綔涓氥��
+ <span class="text-danger">鎵嬪姩娣诲姞鏃讹紝璇锋鏌ュ崟鎹紪鍙锋槸鍚﹀湪ERP绯荤粺涓凡瀛樺湪锛岄伩鍏嶅彂鐢熸暟鎹敊璇棶棰樸��</span>
+ </div>
</div>
</div>
- <div class="layui-card">
- <div class="layui-card-body">
- 鍏ュ簱閫氱煡鍗曪細鐢盓RP鎻愪緵鍗曟嵁缂栧彿銆佺被鍨嬨�佸崟鎹椂闂村強鐗╂枡鏄庣粏锛岀敓鎴愬叆搴撲綔涓氬崟锛屼负缁存姢绯荤粺楂樺彲鐢紝鐢ㄦ埛鍙嚜琛屾坊鍔犲叆搴撻�氱煡鍗曟暟鎹紝瀹屾垚鐙珛鐨勫叆搴撲綔涓氥��
- <span class="text-danger">鎵嬪姩娣诲姞鏃讹紝璇锋鏌ュ崟鎹紪鍙锋槸鍚﹀湪ERP绯荤粺涓凡瀛樺湪锛岄伩鍏嶅彂鐢熸暟鎹敊璇棶棰樸��</span>
+
+ <script type="text/html" id="toolbar">
+ <div class="layui-btn-container">
+ <!-- 鍟嗗搧/鐗╂枡 鏁版嵁涓績 -->
+ <div class="dropdown-menu" style="float: right">
+ <button class="layui-btn layui-btn-primary layui-border-black icon-btn layui-btn-sm"> Excel妯℃澘 <i class="layui-icon layui-icon-drop"></i></button>
+ <ul class="dropdown-menu-nav dark">
+ <div class="dropdown-anchor"></div>
+ <li class="title">1st menu</li>
+ <li><a onclick="excelMouldDownload()" style="font-size: 12px"><i class="layui-icon layui-icon-template-1"></i>妯℃澘涓嬭浇</a></li>
+ <li><a onclick="importExcel()" style="font-size: 12px"><i class="layui-icon layui-icon-upload"></i>瀵煎叆 Excel</a></li>
+ <li style="display: none"><input id="importExcel" type="file" onchange="upload(this)" ></li>
+ </ul>
+ </div>
</div>
- </div>
-</div>
-<!-- 琛ㄦ牸鎿嶄綔鍒� -->
-<script type="text/html" id="operate">
+ </script>
+
+ <!-- 琛ㄦ牸鎿嶄綔鍒� -->
+ <script type="text/html" id="operate">
{{# if (d.settle == 0 || d.settle == 1) { }}
<a class="layui-btn layui-btn-primary layui-btn-xs btn-edit" lay-event="edit">淇敼</a>
<a class="layui-btn layui-btn-danger layui-btn-xs btn-delete" lay-event="del">鍒犻櫎</a>
@@ -104,26 +128,22 @@
<a class="layui-btn layui-btn-primary layui-border-blue layui-btn-xs btn-complete" lay-event="complete">瀹岀粨</a>
{{# } }}
</script>
-<!-- 琛ㄦ牸鎿嶄綔鍒� -->
-<script type="text/html" id="tbLook">
+ <!-- 琛ㄦ牸鎿嶄綔鍒� -->
+ <script type="text/html" id="tbLook">
<span class="layui-text">
<a href="javascript:;" lay-event="look">
<i class="layui-icon" style="font-size: 12px;"></i> 鏌ョ湅鍗曟嵁鏄庣粏
</a>
</span>
</script>
-<script type="text/html" id="orderNoTpl">
+ <script type="text/html" id="orderNoTpl">
{{d.orderNo}}
{{# if(d.settle > 1 && d.settle !== 3){ }}
{{# } }}
<i class="layui-icon layui-icon-about wrk-trace" lay-tips="鏌ョ湅浠诲姟杩芥函" lay-direction="2" lay-offset="-10px,0px" lay-event="wrkTrace"></i>
</script>
-
-<!--<script type="text/html" id="settleTpl">-->
-<!-- <span name="settle" class="layui-badge layui-badge-gray">{{d.settle$}}</span>-->
-<!--</script>-->
-<script type="text/html" id="settleTpl">
+ <script type="text/html" id="settleTpl">
<span name="settle"
{{# if( d.settle === 1){ }}
class="layui-badge layui-badge-red"
@@ -140,8 +160,8 @@
{{# } }}
>{{d.settle$}}</span>
</script>
-<!-- 琛ㄥ崟寮圭獥 -->
-<script type="text/html" id="editDialog">
+ <!-- 琛ㄥ崟寮圭獥 -->
+ <script type="text/html" id="editDialog">
<form id="editForm" lay-filter="editForm" class="layui-form model-form">
<input name="id" type="hidden"/>
<div class="layui-form-item">
@@ -179,13 +199,13 @@
</div>
</form>
</script>
-<!-- 琛ㄦ牸鎿嶄綔鍒� -->
-<script type="text/html" id="formSSXMTableBar">
+ <!-- 琛ㄦ牸鎿嶄綔鍒� -->
+ <script type="text/html" id="formSSXMTableBar">
<!-- <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="edit">淇敼</a>-->
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">鍒犻櫎</a>
-</script>
-<!-- 琛ㄥ崟寮圭獥 -->
-<script type="text/html" id="matEditDialog">
+ </script>
+ <!-- 琛ㄥ崟寮圭獥 -->
+ <script type="text/html" id="matEditDialog">
<form id="matEditForm" lay-filter="matEditForm" class="layui-form model-form">
<input name="experimentId" type="hidden"/>
<div class="layui-form-item" style="float: left">
@@ -201,8 +221,8 @@
</div>
</form>
</script>
-<!-- 璁㈠崟浠诲姟杩芥函 -->
-<script id="wrkTraceDialog" type="text/html" style="position: relative">
+ <!-- 璁㈠崟浠诲姟杩芥函 -->
+ <script id="wrkTraceDialog" type="text/html" style="position: relative">
<div style="position: absolute; top: 0; left: 0;">
<div class="layui-card" style="overflow: hidden;">
<div class="layui-card-header" style="text-align: center;width: 80%;font-weight: inherit;font-size: 18px">{{ d.orderNo }}</div>
@@ -298,18 +318,27 @@
{{# } }}
</div>
</div>
-
-
</script>
-<script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
-<script type="text/javascript" src="../../static/js/handlebars/handlebars-v4.5.3.js"></script>
-<script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script>
-<script type="text/javascript" src="../../static/js/echarts/echarts.min.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>
-<script type="text/javascript" src="../../static/js/order/order.js" charset="utf-8"></script>
+ <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
+ <script type="text/javascript" src="../../static/js/handlebars/handlebars-v4.5.3.js"></script>
+ <script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script>
+ <script type="text/javascript" src="../../static/js/echarts/echarts.min.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>
+ <script type="text/javascript" src="../../static/js/order/order.js" charset="utf-8"></script>
+ <script>
+ layui.config({
+ base: baseUrl + "/static/layui/lay/modules/"
+ }).extend({
+ dropdown: 'dropdown/dropdown'
+ }).use(['dropdown'], function () {
+ var dropdown = layui.dropdown;
+ dropdown.init();
+ dropdown.openClickNavClose();
+ });
+ </script>
-<script type="text/template" id="docTypeTpl">
+ <script type="text/template" id="docTypeTpl">
<option value="">閫夋嫨绫诲瀷</option>
{{#each records}}
<option value="{{docId}}">{{docName}}</option>
@@ -317,5 +346,4 @@
</script>
</body>
-</html>
-
+</html>
\ No newline at end of file
--
Gitblit v1.9.1