Merge remote-tracking branch 'origin/stasrs' into stasrs
|  |  |  | 
|---|
|  |  |  | import com.core.common.*; | 
|---|
|  |  |  | import com.core.exception.CoolException; | 
|---|
|  |  |  | import com.zy.asrs.entity.param.*; | 
|---|
|  |  |  | import com.zy.asrs.entity.result.StockVo; | 
|---|
|  |  |  | import com.zy.asrs.service.OpenService; | 
|---|
|  |  |  | import com.zy.common.model.DetlDto; | 
|---|
|  |  |  | import com.zy.common.web.BaseController; | 
|---|
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @RequestMapping("/stock/default/v1") | 
|---|
|  |  |  | public R queryStock(@RequestHeader(required = false) String appkey, | 
|---|
|  |  |  | @RequestBody StockVo stockVo, | 
|---|
|  |  |  | HttpServletRequest request) { | 
|---|
|  |  |  | auth(appkey, null, request); | 
|---|
|  |  |  | return R.ok().add(openService.queryStock()); | 
|---|
|  |  |  | auth(appkey, stockVo, request); | 
|---|
|  |  |  | return R.ok().add(openService.queryStock(stockVo)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void auth(String appkey, Object obj, HttpServletRequest request) { | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Double queryStockAnfme(String matnr, String batch); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<StockVo> queryStockTotal(); | 
|---|
|  |  |  | List<StockVo> queryStockTotal(@Param("matnr")String matnr,@Param("batch")String batch); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Integer sum(); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Double queryStockAnfme(String matnr, String batch); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<StockVo> queryStockTotal(); | 
|---|
|  |  |  | List<StockVo> queryStockTotal(StockVo stockVo); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Integer sum(); | 
|---|
|  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 库存统计 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | List<StockVo> queryStock(); | 
|---|
|  |  |  | List<StockVo> queryStock(StockVo stockVo); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // ------------------------------------------ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<StockVo> queryStockTotal() { | 
|---|
|  |  |  | return this.baseMapper.queryStockTotal(); | 
|---|
|  |  |  | public List<StockVo> queryStockTotal(StockVo stockVo) { | 
|---|
|  |  |  | String matnr=stockVo.getMatnr(); | 
|---|
|  |  |  | String batch=stockVo.getBatch(); | 
|---|
|  |  |  | return this.baseMapper.queryStockTotal(matnr,batch); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | list.add(dto); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | dto.setWeight(detail.getWeight()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | for (DetlDto detlDto : list) { | 
|---|
|  |  |  | Mat mat = matService.selectByMatnr(detlDto.getMatnr()); | 
|---|
|  |  |  | 
|---|
|  |  |  | orderDetl.setUpdateTime(now); | 
|---|
|  |  |  | orderDetl.setStatus(1); | 
|---|
|  |  |  | orderDetl.setQty(0.0D); | 
|---|
|  |  |  | orderDetl.setWeight(detlDto.getWeight()); | 
|---|
|  |  |  | if (!orderDetlService.insert(orderDetl)) { | 
|---|
|  |  |  | throw new CoolException("生成单据明细失败,请联系管理员"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | list.add(dto); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | dto.setWeight(detail.getWeight()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | for (DetlDto detlDto : list) { | 
|---|
|  |  |  | Mat mat = matService.selectByMatnr(detlDto.getMatnr()); | 
|---|
|  |  |  | 
|---|
|  |  |  | orderDetl.setUpdateTime(now); | 
|---|
|  |  |  | orderDetl.setStatus(1); | 
|---|
|  |  |  | orderDetl.setQty(0.0D); | 
|---|
|  |  |  | orderDetl.setWeight(detlDto.getWeight()); | 
|---|
|  |  |  | if (!orderDetlService.insert(orderDetl)) { | 
|---|
|  |  |  | throw new CoolException("生成单据明细失败,请联系管理员"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | @Transactional | 
|---|
|  |  |  | public List<StockVo> queryStock() { | 
|---|
|  |  |  | return locDetlService.queryStockTotal(); | 
|---|
|  |  |  | public List<StockVo> queryStock(StockVo stockVo) { | 
|---|
|  |  |  | return locDetlService.queryStockTotal(stockVo); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | 
|---|
|  |  |  | mat.setStatus(1); | 
|---|
|  |  |  | mat.setCreateTime(now); | 
|---|
|  |  |  | mat.setUpdateTime(now); | 
|---|
|  |  |  | if (Cools.isEmpty(matParam.getLength()) || matParam.getLength() == 0) { | 
|---|
|  |  |  | mat.setLength(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!matService.insert(mat)) { | 
|---|
|  |  |  | throw new CoolException("服务器内部错误,请联系管理员"); | 
|---|
|  |  |  | } else { | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.task; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.zy.asrs.task.handler.ErpAccessTokenHandler; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.scheduling.annotation.Scheduled; | 
|---|
|  |  |  | import org.springframework.stereotype.Component; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.annotation.PostConstruct; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Component | 
|---|
|  |  |  | public class ErpAccessTokenScheduler { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public static String accessToken = ""; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ErpAccessTokenHandler erpAccessTokenHandler; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PostConstruct | 
|---|
|  |  |  | @Scheduled(cron = "10 15,30,45,59 * * * ?") | 
|---|
|  |  |  | private void accessToken(){ | 
|---|
|  |  |  | erpAccessTokenHandler.getAccessToken(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.task; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.mapper.EntityWrapper; | 
|---|
|  |  |  | import com.zy.asrs.entity.Order; | 
|---|
|  |  |  | import com.zy.asrs.service.OrderService; | 
|---|
|  |  |  | import com.zy.asrs.task.handler.OrderSendHandler; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.scheduling.annotation.Scheduled; | 
|---|
|  |  |  | import org.springframework.stereotype.Component; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Component | 
|---|
|  |  |  | public class OrderSendScheduler { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private OrderService orderService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private OrderSendHandler orderSendHandler; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Scheduled(cron = "0/3 * * * * ? ") | 
|---|
|  |  |  | private void looping(){ | 
|---|
|  |  |  | List<Order> orders = orderService.selectList(new EntityWrapper<Order>() | 
|---|
|  |  |  | .eq("settle", "4") | 
|---|
|  |  |  | .le("item_id", 3)); | 
|---|
|  |  |  | for (Order order : orders) { | 
|---|
|  |  |  | orderSendHandler.start(order); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.task.handler; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSON; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.core.exception.CoolException; | 
|---|
|  |  |  | import com.zy.asrs.task.AbstractHandler; | 
|---|
|  |  |  | import com.zy.asrs.task.ErpAccessTokenScheduler; | 
|---|
|  |  |  | import com.zy.common.utils.HttpHandler; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.io.IOException; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Service | 
|---|
|  |  |  | @Slf4j | 
|---|
|  |  |  | public class ErpAccessTokenHandler extends AbstractHandler<String> { | 
|---|
|  |  |  | private String erpIp = "http://10.100.221.19:81"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void getAccessToken() { | 
|---|
|  |  |  | JSONObject appTokenJson = new JSONObject(); | 
|---|
|  |  |  | appTokenJson.put("appId", "ESB"); | 
|---|
|  |  |  | appTokenJson.put("appSecuret", "123456789"); | 
|---|
|  |  |  | appTokenJson.put("tenantid", "ierp"); | 
|---|
|  |  |  | appTokenJson.put("accountId", "1492035591649364992"); | 
|---|
|  |  |  | appTokenJson.put("language", "zh_CN"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | JSONObject appTokenResp; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //获取app_token,用app_token获取access_token | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | appTokenResp = JSON.parseObject(new HttpHandler.Builder() | 
|---|
|  |  |  | .setUri(erpIp) | 
|---|
|  |  |  | .setPath("/ierp/api/getAppToken.do") | 
|---|
|  |  |  | .setJson(appTokenJson.toJSONString()) | 
|---|
|  |  |  | .build() | 
|---|
|  |  |  | .doPost()); | 
|---|
|  |  |  | } catch (IOException e) { | 
|---|
|  |  |  | log.info("连接erp服务器超时"); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | JSONObject data = null; | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | data = (JSONObject) appTokenResp.get("data"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | System.out.println("获取appToken为空"); | 
|---|
|  |  |  | throw new CoolException(e); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //获取access_token | 
|---|
|  |  |  | if ((boolean) data.get("success")) { | 
|---|
|  |  |  | JSONObject accessTokenJson = new JSONObject(); | 
|---|
|  |  |  | accessTokenJson.put("user", "13800000000"); | 
|---|
|  |  |  | accessTokenJson.put("apptoken", (String) data.get("app_token")); | 
|---|
|  |  |  | accessTokenJson.put("tenantid", "ierp"); | 
|---|
|  |  |  | accessTokenJson.put("accountId", "1492035591649364992"); | 
|---|
|  |  |  | accessTokenJson.put("usertype", "Mobile"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | JSONObject accessTokenResp; | 
|---|
|  |  |  | //获取app_token,用app_token获取access_token | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | accessTokenResp = JSON.parseObject(new HttpHandler.Builder() | 
|---|
|  |  |  | .setUri(erpIp) | 
|---|
|  |  |  | .setPath("/ierp/api/login.do") | 
|---|
|  |  |  | .setJson(accessTokenJson.toJSONString()) | 
|---|
|  |  |  | .build() | 
|---|
|  |  |  | .doPost()); | 
|---|
|  |  |  | } catch (IOException e) { | 
|---|
|  |  |  | throw new RuntimeException(e); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | JSONObject accessTokenData = null; | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | accessTokenData = (JSONObject) accessTokenResp.get("data"); | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | System.out.println("获取accessToken为空"); | 
|---|
|  |  |  | throw new CoolException(e); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if ((boolean) accessTokenData.get("success")) { | 
|---|
|  |  |  | ErpAccessTokenScheduler.accessToken = (String) accessTokenData.get("access_token"); | 
|---|
|  |  |  | log.info("更新access_token, 新token为:" + (String) accessTokenData.get("access_token")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.task.handler; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSON; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.mapper.EntityWrapper; | 
|---|
|  |  |  | import com.zy.asrs.entity.DocType; | 
|---|
|  |  |  | import com.zy.asrs.entity.Order; | 
|---|
|  |  |  | import com.zy.asrs.service.DocTypeService; | 
|---|
|  |  |  | import com.zy.asrs.service.OrderService; | 
|---|
|  |  |  | import com.zy.asrs.task.AbstractHandler; | 
|---|
|  |  |  | import com.zy.asrs.task.ErpAccessTokenScheduler; | 
|---|
|  |  |  | import com.zy.common.utils.HttpHandler; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  | import org.springframework.transaction.annotation.Transactional; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.io.IOException; | 
|---|
|  |  |  | import java.util.HashMap; | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Slf4j | 
|---|
|  |  |  | @Service | 
|---|
|  |  |  | @Transactional | 
|---|
|  |  |  | public class OrderSendHandler extends AbstractHandler<String> { | 
|---|
|  |  |  | private static final String erpIp = "10.100.221.19:81"; | 
|---|
|  |  |  | private static final String inPath = "/ierp/kapi/app/im/PurinbillApiPlugin"; | 
|---|
|  |  |  | private static final String outPath = "/ierp/kapi/app/im/SaloutbillApiPlugin"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private OrderService orderService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private DocTypeService docTypeService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void start(Order order) { | 
|---|
|  |  |  | String accessToken = ErpAccessTokenScheduler.accessToken; | 
|---|
|  |  |  | if (accessToken.equals("")) { | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | HashMap<String, Object> header = new HashMap<>(); | 
|---|
|  |  |  | header.put("accessToken",accessToken); | 
|---|
|  |  |  | JSONObject jsonObject = new JSONObject(); | 
|---|
|  |  |  | jsonObject.put("orderNo",order.getOrderNo()); | 
|---|
|  |  |  | HttpHandler.Builder prepBuilder = new HttpHandler.Builder() | 
|---|
|  |  |  | .setUri(erpIp) | 
|---|
|  |  |  | .setHeaders(header) | 
|---|
|  |  |  | .setJson(jsonObject.toJSONString()); | 
|---|
|  |  |  | JSONObject respJson; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //入库单据 | 
|---|
|  |  |  | if (docTypeService.selectOne(new EntityWrapper<DocType>() | 
|---|
|  |  |  | .eq("doc_id",order.getDocType())).getPakin() == 1) { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | respJson = JSON.parseObject( | 
|---|
|  |  |  | prepBuilder.setPath(inPath) | 
|---|
|  |  |  | .build() | 
|---|
|  |  |  | .doPost()); | 
|---|
|  |  |  | } catch (IOException e) { | 
|---|
|  |  |  | throw new RuntimeException(e); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | //出库单据 | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | respJson = JSON.parseObject( | 
|---|
|  |  |  | prepBuilder.setPath(outPath) | 
|---|
|  |  |  | .build() | 
|---|
|  |  |  | .doPost()); | 
|---|
|  |  |  | } catch (IOException e) { | 
|---|
|  |  |  | throw new RuntimeException(e); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if ((boolean)respJson.get("success")) { | 
|---|
|  |  |  | orderService.updateSettle(order.getId(),6L,1L); | 
|---|
|  |  |  | log.info("单据:" + order.getOrderNo() + "回传成功,已更新单据状态"); | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | order.setItemId(order.getItemId() + 1); | 
|---|
|  |  |  | orderService.updateById(order); | 
|---|
|  |  |  | log.info("单据:"+ order.getOrderNo()+" 回传失败,这是第" + order.getItemId() + "次回传"); | 
|---|
|  |  |  | log.info(respJson.toJSONString()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private Double anfme; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private Double weight; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public DetlDto() { | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | enabled: false | 
|---|
|  |  |  | datasource: | 
|---|
|  |  |  | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver | 
|---|
|  |  |  | #    url: jdbc:sqlserver://10.10.10.100:1433;databasename=stasrs | 
|---|
|  |  |  | url: jdbc:sqlserver://192.168.4.15:1433;databasename=stasrs | 
|---|
|  |  |  | url: jdbc:sqlserver://10.10.10.100:1433;databasename=stasrs | 
|---|
|  |  |  | #    url: jdbc:sqlserver://192.168.4.15:1433;databasename=stasrs | 
|---|
|  |  |  | username: sa | 
|---|
|  |  |  | password: sa@123 | 
|---|
|  |  |  | mvc: | 
|---|
|  |  |  | 
|---|
|  |  |  | select | 
|---|
|  |  |  | matnr, | 
|---|
|  |  |  | batch, | 
|---|
|  |  |  | count(anfme) as count | 
|---|
|  |  |  | sum(anfme) as count | 
|---|
|  |  |  | from asr_loc_detl | 
|---|
|  |  |  | where 1=1 | 
|---|
|  |  |  | <if test="batch != null and batch != ''"> | 
|---|
|  |  |  | and batch = #{batch} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="matnr != null and matnr != ''"> | 
|---|
|  |  |  | and matnr = #{matnr} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | group by matnr,batch | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | <select id="sum" resultType="java.lang.Integer"> | 
|---|
|  |  |  | 
|---|
|  |  |  | // 详情窗口-宽度 | 
|---|
|  |  |  | var detailWidth = '90%'; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function checkPassword(password) { | 
|---|
|  |  |  | //密码必须包含字符和数字长度不能少于8位 | 
|---|
|  |  |  | let pattern = /(?=.*[0-9])(?=.*[a-zA-Z!@#$]).{8,}/ | 
|---|
|  |  |  | //不能包含连续数字 | 
|---|
|  |  |  | let pattern2 = /(0(?=1)|1(?=2)|2(?=3)|3(?=4)|4(?=5)|5(?=6)|6(?=7)|7(?=8)|8(?=9)){3}\d/ | 
|---|
|  |  |  | //重复数字不能超过四位 | 
|---|
|  |  |  | let pattern3 = /(\d)\1{3}/ | 
|---|
|  |  |  | if (pattern.test(password) && pattern2.test(password) === false && pattern3.test(password) === false) { | 
|---|
|  |  |  | //匹配放行 | 
|---|
|  |  |  | return true | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //不匹配要求修改密码1 | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 非空判断 | 
|---|
|  |  |  | function isEmpty(obj){ | 
|---|
|  |  |  | return typeof obj == "undefined" || obj == null || obj === ""; | 
|---|
|  |  |  | 
|---|
|  |  |  | {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}, | 
|---|
|  |  |  | {field: 'createBy$', align: 'center', title: '操作员',  minWidth: 160, width: 160}, | 
|---|
|  |  |  | {align: 'center', title: '操作', toolbar: '#operate', width: 260} | 
|---|
|  |  |  | ]], | 
|---|
|  |  |  | request: { | 
|---|
|  |  |  | 
|---|
|  |  |  | // }, | 
|---|
|  |  |  | // {field: 'inQty', title: '已入库量'}, | 
|---|
|  |  |  | // {field: 'color', title: '颜色'}, | 
|---|
|  |  |  | {field: 'specs', title: '规格'} | 
|---|
|  |  |  | {field: 'specs', title: '规格'}, | 
|---|
|  |  |  | {field: 'weight', title: '重量'} | 
|---|
|  |  |  | ]], | 
|---|
|  |  |  | request: { | 
|---|
|  |  |  | pageName: 'curr', | 
|---|
|  |  |  | 
|---|
|  |  |  | <cite id="username" style="margin-right: 5px">管理员</cite> | 
|---|
|  |  |  | </a> | 
|---|
|  |  |  | <dl class="layui-nav-child"> | 
|---|
|  |  |  | <dd lay-unselect><a ew-href="detail.html?resourceId=8">基本资料</a></dd> | 
|---|
|  |  |  | <dd lay-unselect><a id="personPage" ew-href="detail.html?resourceId=8">基本资料</a></dd> | 
|---|
|  |  |  | <hr> | 
|---|
|  |  |  | <dd lay-unselect><a id="logout">退出</a></dd> | 
|---|
|  |  |  | </dl> | 
|---|
|  |  |  | 
|---|
|  |  |  | var url = logout.getAttribute('href'); | 
|---|
|  |  |  | logout.setAttribute('href', baseUrl + "/login"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | let username = localStorage.getItem('username') | 
|---|
|  |  |  | let password = localStorage.getItem('password') | 
|---|
|  |  |  | if (!(username === 'super' || password === 'root')) { | 
|---|
|  |  |  | if(!checkPassword(password)){ | 
|---|
|  |  |  | //要求修改密码 | 
|---|
|  |  |  | layer.msg('弱密码请修改密码再继续', {icon: 2}); | 
|---|
|  |  |  | layer.open({ | 
|---|
|  |  |  | type: 2, | 
|---|
|  |  |  | title: '基本资料', | 
|---|
|  |  |  | maxmin: true, | 
|---|
|  |  |  | shadeClose: false, | 
|---|
|  |  |  | area: [top.detailWidth, top.detailHeight], | 
|---|
|  |  |  | content: 'detail.html', | 
|---|
|  |  |  | closeBtn: 0, | 
|---|
|  |  |  | success: function(layero, index){ | 
|---|
|  |  |  | layero.find('.layui-layer-min').remove(); //去掉最小化按钮 | 
|---|
|  |  |  | layero.find('.layui-layer-max').remove(); //去掉最大化按钮 | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  | <script type="text/html" id="menuTpl"> | 
|---|
|  |  |  | 
|---|
|  |  |  | if (res.code === 200){ | 
|---|
|  |  |  | localStorage.setItem("token", res.data.token); | 
|---|
|  |  |  | localStorage.setItem("username", res.data.username); | 
|---|
|  |  |  | localStorage.setItem("password", password); | 
|---|
|  |  |  | window.location.href = "index.html"; | 
|---|
|  |  |  | } else if (res.code === 10001) { | 
|---|
|  |  |  | layer.tips(res.msg, '#username', {tips: [4, '#ff0000']}); | 
|---|
|  |  |  | 
|---|
|  |  |  | if (parent.$('#password').val() === hex_md5(val)) { | 
|---|
|  |  |  | return "与旧密码不能相同"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | let username = localStorage.getItem('username') | 
|---|
|  |  |  | if (!(username === 'super' || password === 'root')){ | 
|---|
|  |  |  | if(!checkPassword(val)){ | 
|---|
|  |  |  | //密码必须包含字符和数字 | 
|---|
|  |  |  | return "密码必须包含字符和数字长度不能少于8位,且不能包含连续数字和四位重复数字"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | rePwd: function (val) { | 
|---|
|  |  |  | if ($('#password').val() !== val){ | 
|---|
|  |  |  | return "密码不一致"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | let username = localStorage.getItem('username') | 
|---|
|  |  |  | if (!(username === 'super' || password === 'root')){ | 
|---|
|  |  |  | if(!checkPassword(val)){ | 
|---|
|  |  |  | //密码必须包含字符和数字 | 
|---|
|  |  |  | return "密码必须包含字符和数字长度不能少于8位,且不能包含连续数字和四位重复数字"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|