Merge remote-tracking branch 'origin/tzhtasrs' into tzhtasrs
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.excel.EasyExcel; | 
|---|
|  |  |  | import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSON; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONArray; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.mapper.EntityWrapper; | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.core.annotations.ManagerAuth; | 
|---|
|  |  |  | import com.core.common.*; | 
|---|
|  |  |  | import com.core.exception.CoolException; | 
|---|
|  |  |  | import com.zy.asrs.entity.LocDetl; | 
|---|
|  |  |  | import com.zy.asrs.entity.Mat; | 
|---|
|  |  |  | import com.zy.asrs.entity.MatPrint; | 
|---|
|  |  |  | import com.zy.asrs.entity.OrderDetl; | 
|---|
|  |  |  | import com.zy.asrs.entity.*; | 
|---|
|  |  |  | import com.zy.asrs.entity.param.InFormIdParam; | 
|---|
|  |  |  | import com.zy.asrs.entity.result.KeyValueVo; | 
|---|
|  |  |  | import com.zy.asrs.service.ApiLogService; | 
|---|
|  |  |  | import com.zy.asrs.service.LocDetlService; | 
|---|
|  |  |  | import com.zy.asrs.service.MatService; | 
|---|
|  |  |  | import com.zy.asrs.service.TagService; | 
|---|
|  |  |  | import com.zy.asrs.task.core.ReturnT; | 
|---|
|  |  |  | import com.zy.asrs.task.kingdee.handler.LoginAuthenticationHandler; | 
|---|
|  |  |  | import com.zy.asrs.utils.MatExcelListener; | 
|---|
|  |  |  | import com.zy.common.CodeRes; | 
|---|
|  |  |  | import com.zy.common.config.AdminInterceptor; | 
|---|
|  |  |  | import com.zy.common.entity.MatExcel; | 
|---|
|  |  |  | import com.zy.common.utils.BarcodeUtils; | 
|---|
|  |  |  | import com.zy.common.utils.HttpHandler; | 
|---|
|  |  |  | import com.zy.common.utils.QrCode; | 
|---|
|  |  |  | import com.zy.common.web.BaseController; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Value; | 
|---|
|  |  |  | import org.springframework.transaction.annotation.Transactional; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  | import org.springframework.web.multipart.MultipartFile; | 
|---|
|  |  |  | 
|---|
|  |  |  | import java.awt.image.BufferedImage; | 
|---|
|  |  |  | import java.io.IOException; | 
|---|
|  |  |  | import java.net.URLEncoder; | 
|---|
|  |  |  | import java.text.SimpleDateFormat; | 
|---|
|  |  |  | import java.time.LocalDateTime; | 
|---|
|  |  |  | import java.time.format.DateTimeFormatter; | 
|---|
|  |  |  | import java.util.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RestController | 
|---|
|  |  |  | @Slf4j | 
|---|
|  |  |  | public class MatController extends BaseController { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Value("${erp.address.URL}") | 
|---|
|  |  |  | //端口 | 
|---|
|  |  |  | private String URL; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Value("${erp.address.inaddress}") | 
|---|
|  |  |  | //单据,商品档案地址 | 
|---|
|  |  |  | private String inaddress; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private TagService tagService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ApiLogService apiLogService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private MatService matService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private LocDetlService locDetlService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SnowflakeIdWorker snowflakeIdWorker; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private LoginAuthenticationHandler loginAuthenticationHandler; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/mat/auto/matnr/auth") | 
|---|
|  |  |  | public R autoMatnr(){ | 
|---|
|  |  |  | 
|---|
|  |  |  | if (null != matService.selectByMatnr(mat.getMatnr())) { | 
|---|
|  |  |  | return R.error("编号已存在"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Date now = new Date(); | 
|---|
|  |  |  | mat.setCreateBy(getUserId()); | 
|---|
|  |  |  | mat.setCreateTime(now); | 
|---|
|  |  |  | mat.setUpdateBy(getUserId()); | 
|---|
|  |  |  | mat.setUpdateTime(now); | 
|---|
|  |  |  | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | 
|---|
|  |  |  | //登录金蝶 | 
|---|
|  |  |  | ReturnT<String> start = loginAuthenticationHandler.start(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | InFormIdParam inFormIdParam = new InFormIdParam(); | 
|---|
|  |  |  | inFormIdParam.setFormId("BD_MATERIAL"); | 
|---|
|  |  |  | inFormIdParam.setLimit(100); | 
|---|
|  |  |  | inFormIdParam.setStartRow("0"); | 
|---|
|  |  |  | String FDocumentStatus = "C"; | 
|---|
|  |  |  | String FNumber=mat.getMatnr(); | 
|---|
|  |  |  | //条件和需要获得的结果拼接 | 
|---|
|  |  |  | JSONObject jsonObject = new JSONObject(); | 
|---|
|  |  |  | jsonObject.put("FormId", inFormIdParam.getFormId()); | 
|---|
|  |  |  | jsonObject.put("Limit", inFormIdParam.getLimit()); | 
|---|
|  |  |  | jsonObject.put("StartRow", inFormIdParam.getStartRow()); | 
|---|
|  |  |  | jsonObject.put("FilterString", "FDocumentStatus='" + FDocumentStatus +"' and FNumber='"+FNumber+"' and FUseOrgId .FNumber='201'"); | 
|---|
|  |  |  | jsonObject.put("FieldKeys", "FName,FNumber,FCreateDate,FSpecification,FDocumentStatus"); | 
|---|
|  |  |  | JSONObject jsonObject1 = new JSONObject(); | 
|---|
|  |  |  | jsonObject1.put("data", jsonObject); | 
|---|
|  |  |  | String add = jsonObject1.toJSONString(); | 
|---|
|  |  |  | //上报 | 
|---|
|  |  |  | String response = ""; | 
|---|
|  |  |  | boolean success = false; | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | //获取Cookie值 | 
|---|
|  |  |  | HashMap<String, Object> headers = new HashMap<>(); | 
|---|
|  |  |  | headers.put("Cookie", start.getContent()); | 
|---|
|  |  |  | response = new HttpHandler.Builder() | 
|---|
|  |  |  | .setHeaders(headers) | 
|---|
|  |  |  | .setUri(URL) | 
|---|
|  |  |  | .setPath(inaddress) | 
|---|
|  |  |  | .setJson(add) | 
|---|
|  |  |  | .build() | 
|---|
|  |  |  | .doPost(); | 
|---|
|  |  |  | JSONArray data = JSON.parseArray(response); | 
|---|
|  |  |  | if (data.getJSONArray(0).get(0).toString().length()<20) { | 
|---|
|  |  |  | success = true; | 
|---|
|  |  |  | JSONArray jsonArray = data.getJSONArray(0); | 
|---|
|  |  |  | //生成商品档案 | 
|---|
|  |  |  | //商品编号 | 
|---|
|  |  |  | mat = matService.selectByMatnr(jsonArray.get(1).toString()); | 
|---|
|  |  |  | if (mat == null) { | 
|---|
|  |  |  | mat = new Mat(); | 
|---|
|  |  |  | Tag tag = new Tag(); | 
|---|
|  |  |  | mat.setMatnr(jsonArray.get(1).toString()); | 
|---|
|  |  |  | mat.setMaktx(jsonArray.get(0).toString()); | 
|---|
|  |  |  | mat.setSpecs(jsonArray.get(3).toString());//规格 | 
|---|
|  |  |  | mat.setTagId(20L); | 
|---|
|  |  |  | //对美国时间进行转换 | 
|---|
|  |  |  | DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS"); | 
|---|
|  |  |  | DateTimeFormatter formatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME; | 
|---|
|  |  |  | LocalDateTime dateTime = LocalDateTime.parse(jsonArray.get(2).toString(), formatter); | 
|---|
|  |  |  | String format = dateFormat.format(dateTime); | 
|---|
|  |  |  | Date date = sdf.parse(format); | 
|---|
|  |  |  | mat.setCreateTime(date);//商品创建时间 | 
|---|
|  |  |  | mat.setUpdateTime(new Date()); | 
|---|
|  |  |  | mat.setStatus(1); | 
|---|
|  |  |  | //最新抓取商品时间 | 
|---|
|  |  |  | tag.setCreateTime(date); | 
|---|
|  |  |  | tagService.update(tag, new EntityWrapper<Tag>().eq("id", 20)); | 
|---|
|  |  |  | if (!matService.insert(mat)) { | 
|---|
|  |  |  | throw new CoolException("添加失败,请联系管理员"); | 
|---|
|  |  |  | throw new CoolException("服务器内部错误,请联系管理员"); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | log.info("同步新物料[商品编号:{}]", mat.getMatnr()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | throw new CoolException("没有找到指定物料档案,请联系管理员"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | log.error("fail", e); | 
|---|
|  |  |  | //            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); | 
|---|
|  |  |  | } finally { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | // 保存接口日志 | 
|---|
|  |  |  | apiLogService.save( | 
|---|
|  |  |  | "轮询数据", | 
|---|
|  |  |  | URL + inaddress, | 
|---|
|  |  |  | null, | 
|---|
|  |  |  | "127.0.0.1", | 
|---|
|  |  |  | add, | 
|---|
|  |  |  | response, | 
|---|
|  |  |  | success | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | log.error("", e); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.controller; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSON; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONArray; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.mapper.EntityWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.mapper.Wrapper; | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.core.common.*; | 
|---|
|  |  |  | import com.core.exception.CoolException; | 
|---|
|  |  |  | import com.zy.asrs.entity.*; | 
|---|
|  |  |  | import com.zy.asrs.entity.param.InFormIdParam; | 
|---|
|  |  |  | import com.zy.asrs.entity.param.OrderDomainParam; | 
|---|
|  |  |  | import com.zy.asrs.service.*; | 
|---|
|  |  |  | import com.zy.asrs.task.core.ReturnT; | 
|---|
|  |  |  | import com.zy.asrs.task.kingdee.handler.LoginAuthenticationHandler; | 
|---|
|  |  |  | import com.zy.common.model.DetlDto; | 
|---|
|  |  |  | import com.zy.common.utils.HttpHandler; | 
|---|
|  |  |  | import com.zy.common.web.BaseController; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Value; | 
|---|
|  |  |  | import org.springframework.transaction.annotation.Transactional; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.text.SimpleDateFormat; | 
|---|
|  |  |  | import java.time.LocalDateTime; | 
|---|
|  |  |  | import java.time.format.DateTimeFormatter; | 
|---|
|  |  |  | import java.util.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Slf4j | 
|---|
|  |  |  | @RestController | 
|---|
|  |  |  | public class OrderController extends BaseController { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | private WaitPakinService waitPakinService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private LocDetlService locDetlService; | 
|---|
|  |  |  | @Value("${erp.address.URL}") | 
|---|
|  |  |  | //端口 | 
|---|
|  |  |  | private String URL; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Value("${erp.address.inaddress}") | 
|---|
|  |  |  | //单据,商品档案地址 | 
|---|
|  |  |  | private String inaddress; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ApiLogService apiLogService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private LoginAuthenticationHandler loginAuthenticationHandler; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private MatService matService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private TagService tagService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/order/nav/list/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | 
|---|
|  |  |  | return R.ok("订单添加成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/order/form/KingDeeadd/authtest") | 
|---|
|  |  |  | @ManagerAuth(memo = "根据订单类型和订单码添加") | 
|---|
|  |  |  | @Transactional | 
|---|
|  |  |  | public R KingDeeformAddTest(@RequestBody OrderDomainParam param){ | 
|---|
|  |  |  | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | 
|---|
|  |  |  | //登录金蝶 | 
|---|
|  |  |  | ReturnT<String> start = loginAuthenticationHandler.start(); | 
|---|
|  |  |  | InFormIdParam inFormIdParam = new InFormIdParam(); | 
|---|
|  |  |  | //数量字段ncompatible types. Found: 'java.lang.Long', required: 'char, byte, short, int, Character, Byte, Short, Integer, String, or an enum' | 
|---|
|  |  |  | String anfme =null; | 
|---|
|  |  |  | int i=Long.valueOf(param.getDocType()).intValue(); | 
|---|
|  |  |  | switch (i){ | 
|---|
|  |  |  | //采购入库 | 
|---|
|  |  |  | case 13 : inFormIdParam.setFormId("STK_InStock");anfme ="FRealQty"; break; | 
|---|
|  |  |  | //采购退料 | 
|---|
|  |  |  | case 21 : inFormIdParam.setFormId("PUR_MRB");anfme ="FRMREALQTY"; break; | 
|---|
|  |  |  | //生产领料 | 
|---|
|  |  |  | case 22 : inFormIdParam.setFormId("PRD_PickMtrl");anfme ="FActualQty"; break; | 
|---|
|  |  |  | //生产退料 | 
|---|
|  |  |  | case 24 : inFormIdParam.setFormId("PRD_ReturnMtrl");anfme ="FQty"; break; | 
|---|
|  |  |  | //生产补料 | 
|---|
|  |  |  | case 25 : inFormIdParam.setFormId("PRD_FeedMtrl");anfme ="FActualQty"; break; | 
|---|
|  |  |  | //直接调拨单 | 
|---|
|  |  |  | case 26 : inFormIdParam.setFormId("STK_TransferDirect");anfme ="FQty"; break; | 
|---|
|  |  |  | //盘盈单 | 
|---|
|  |  |  | case 28 : inFormIdParam.setFormId("STK_StockCountGain");anfme ="FGainQty"; break; | 
|---|
|  |  |  | //盘亏单 | 
|---|
|  |  |  | case 29 : inFormIdParam.setFormId("STK_StockCountLoss");anfme ="FLossQty"; break; | 
|---|
|  |  |  | //其他出库 | 
|---|
|  |  |  | case 30 : inFormIdParam.setFormId("STK_MisDelivery");anfme ="FQty"; break; | 
|---|
|  |  |  | //简单生产领料 | 
|---|
|  |  |  | case 31 : inFormIdParam.setFormId("SP_PickMtrl");anfme ="FActualQty"; break; | 
|---|
|  |  |  | //简单生产退料 | 
|---|
|  |  |  | case 32 : inFormIdParam.setFormId("SP_ReturnMtrl");anfme ="FQty"; break; | 
|---|
|  |  |  | //销售出库 | 
|---|
|  |  |  | case 14 : inFormIdParam.setFormId("SAL_OUTSTOCK");anfme ="FRealQty"; break; | 
|---|
|  |  |  | //销售退货 | 
|---|
|  |  |  | case 33 : inFormIdParam.setFormId("SAL_RETURNSTOCK");anfme ="FRealQty"; break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | inFormIdParam.setLimit(100); | 
|---|
|  |  |  | inFormIdParam.setStartRow("0"); | 
|---|
|  |  |  | String FDocumentStatus = "B"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //条件和需要获得的结果拼接 | 
|---|
|  |  |  | JSONObject jsonObject = new JSONObject(); | 
|---|
|  |  |  | jsonObject.put("FormId", inFormIdParam.getFormId()); | 
|---|
|  |  |  | jsonObject.put("Limit", inFormIdParam.getLimit()); | 
|---|
|  |  |  | jsonObject.put("StartRow", inFormIdParam.getStartRow()); | 
|---|
|  |  |  | //单据状态 | 
|---|
|  |  |  | FDocumentStatus="B"; | 
|---|
|  |  |  | //订单码 | 
|---|
|  |  |  | String orderNo= param.getOrderNo(); | 
|---|
|  |  |  | jsonObject.put("FilterString", "FBillNo='"+orderNo+"'and FStockId.Fname='立库'"+" and FDocumentStatus='"+FDocumentStatus+"'"); | 
|---|
|  |  |  | jsonObject.put("FieldKeys", "FBillNo,FCreateDate,FMaterialId.FNumber,FMaterialId.FName,FMaterialId.FSpecification,"+anfme+",FDocumentStatus"); | 
|---|
|  |  |  | // FBillNo :单据编号; | 
|---|
|  |  |  | // FCreateDate :单据创建时间; | 
|---|
|  |  |  | // FMaterialId.FNumber : 物料编码; | 
|---|
|  |  |  | // FMaterialName :物料名称; | 
|---|
|  |  |  | // FMaterialId.FSpecification:物料规格 | 
|---|
|  |  |  | // anfme : 物料数量 | 
|---|
|  |  |  | // FDocumentStatus :单据状态; | 
|---|
|  |  |  | JSONObject jsonObject1 = new JSONObject(); | 
|---|
|  |  |  | jsonObject1.put("data", jsonObject); | 
|---|
|  |  |  | String add = jsonObject1.toJSONString(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //上报 | 
|---|
|  |  |  | String response = ""; | 
|---|
|  |  |  | boolean success = false; | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | //获取Cookie值 | 
|---|
|  |  |  | HashMap<String, Object> headers = new HashMap<>(); | 
|---|
|  |  |  | headers.put("Cookie", start.getContent()); | 
|---|
|  |  |  | response = new HttpHandler.Builder() | 
|---|
|  |  |  | .setHeaders(headers) | 
|---|
|  |  |  | .setUri(URL) | 
|---|
|  |  |  | .setPath(inaddress) | 
|---|
|  |  |  | .setJson(add) | 
|---|
|  |  |  | .build() | 
|---|
|  |  |  | .doPost(); | 
|---|
|  |  |  | JSONArray data = JSON.parseArray(response); | 
|---|
|  |  |  | if(data.getJSONArray(0).get(0).toString().length()<20){ | 
|---|
|  |  |  | success = true; | 
|---|
|  |  |  | for (int j = 0; j < data.size(); j++) { | 
|---|
|  |  |  | JSONArray jsonArray = data.getJSONArray(j); | 
|---|
|  |  |  | Order order = orderService.selectByNo(jsonArray.get(0).toString()); | 
|---|
|  |  |  | if (Cools.isEmpty(order)) { | 
|---|
|  |  |  | DocType docType = docTypeService.selectById(param.getDocType()); | 
|---|
|  |  |  | Date now = new Date(); | 
|---|
|  |  |  | // 单据主档 | 
|---|
|  |  |  | order = new Order( | 
|---|
|  |  |  | String.valueOf(snowflakeIdWorker.nextId()),    // 编号[非空] | 
|---|
|  |  |  | jsonArray.get(0).toString(),    // 订单编号 | 
|---|
|  |  |  | DateUtils.convert(now),    // 单据日期 | 
|---|
|  |  |  | docType.getDocId(),    // 单据类型 | 
|---|
|  |  |  | null,    // 项目编号 | 
|---|
|  |  |  | null,    // | 
|---|
|  |  |  | null,    // 调拨项目编号 | 
|---|
|  |  |  | null,    // 初始票据号 | 
|---|
|  |  |  | null,    // 票据号 | 
|---|
|  |  |  | null,    // 客户编号 | 
|---|
|  |  |  | null,    // 客户 | 
|---|
|  |  |  | null,    // 联系方式 | 
|---|
|  |  |  | null,    // 操作人员 | 
|---|
|  |  |  | null,    // 合计金额 | 
|---|
|  |  |  | null,    // 优惠率 | 
|---|
|  |  |  | null,    // 优惠金额 | 
|---|
|  |  |  | null,    // 销售或采购费用合计 | 
|---|
|  |  |  | null,    // 实付金额 | 
|---|
|  |  |  | null,    // 付款类型 | 
|---|
|  |  |  | null,    // 业务员 | 
|---|
|  |  |  | null,    // 结算天数 | 
|---|
|  |  |  | null,    // 邮费支付类型 | 
|---|
|  |  |  | null,    // 邮费 | 
|---|
|  |  |  | null,    // 付款时间 | 
|---|
|  |  |  | null,    // 发货时间 | 
|---|
|  |  |  | null,    // 物流名称 | 
|---|
|  |  |  | null,    // 物流单号 | 
|---|
|  |  |  | 1L,    // 订单状态 | 
|---|
|  |  |  | 1,    // 状态 | 
|---|
|  |  |  | 9527L,    // 添加人员 | 
|---|
|  |  |  | now,    // 添加时间 | 
|---|
|  |  |  | 9527L,    // 修改人员 | 
|---|
|  |  |  | now,    // 修改时间 | 
|---|
|  |  |  | null    // 备注 | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | //对美国时间进行转换 | 
|---|
|  |  |  | DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS"); | 
|---|
|  |  |  | DateTimeFormatter formatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME; | 
|---|
|  |  |  | LocalDateTime dateTime = LocalDateTime.parse(jsonArray.get(1).toString(), formatter); | 
|---|
|  |  |  | String format = dateFormat.format(dateTime); | 
|---|
|  |  |  | Date date = sdf.parse(format); | 
|---|
|  |  |  | //最新抓取时间 | 
|---|
|  |  |  | docType.setCreateTime(date); | 
|---|
|  |  |  | docTypeService.update(docType, new EntityWrapper<DocType>().eq("doc_id", param.getDocType())); | 
|---|
|  |  |  | if (!orderService.insert(order)) { | 
|---|
|  |  |  | throw new CoolException("生成单据主档失败,请联系管理员"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //物料编码 | 
|---|
|  |  |  | Mat mat = matService.selectByMatnr(jsonArray.get(2).toString()); | 
|---|
|  |  |  | if (Cools.isEmpty(mat)) { | 
|---|
|  |  |  | throw new CoolException(jsonArray.get(2).toString() + "编号商品检索失败,请先添加商品"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | OrderDetl orderDetl1 = orderDetlService.selectOne(new EntityWrapper<OrderDetl>().eq("order_no", jsonArray.get(0).toString()).eq("matnr", jsonArray.get(2).toString())); | 
|---|
|  |  |  | if (!Cools.isEmpty(orderDetl1)) { | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | DocType docType = docTypeService.selectById(param.getDocType()); | 
|---|
|  |  |  | OrderDetl orderDetl = new OrderDetl(); | 
|---|
|  |  |  | orderDetl.sync(mat); | 
|---|
|  |  |  | orderDetl.setBatch(null); | 
|---|
|  |  |  | orderDetl.setAnfme(Double.parseDouble(jsonArray.get(5).toString())); | 
|---|
|  |  |  | orderDetl.setOrderId(order.getId()); | 
|---|
|  |  |  | orderDetl.setOrderNo(order.getOrderNo()); | 
|---|
|  |  |  | orderDetl.setCreateBy(9527L); | 
|---|
|  |  |  | orderDetl.setCreateTime(new Date()); | 
|---|
|  |  |  | orderDetl.setUpdateBy(9527L); | 
|---|
|  |  |  | orderDetl.setUpdateTime(new Date()); | 
|---|
|  |  |  | orderDetl.setStatus(1); | 
|---|
|  |  |  | orderDetl.setQty(0.0D); | 
|---|
|  |  |  | DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS"); | 
|---|
|  |  |  | DateTimeFormatter formatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME; | 
|---|
|  |  |  | LocalDateTime dateTime = LocalDateTime.parse(jsonArray.get(1).toString(), formatter); | 
|---|
|  |  |  | String format = dateFormat.format(dateTime); | 
|---|
|  |  |  | Date date = sdf.parse(format); | 
|---|
|  |  |  | //最新抓取时间 | 
|---|
|  |  |  | docType.setCreateTime(date); | 
|---|
|  |  |  | if (!orderDetlService.insert(orderDetl)) { | 
|---|
|  |  |  | throw new CoolException("生成单据明细失败,请联系管理员"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | throw new CoolException("没有找到指定订单,请联系管理员"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | log.error("fail", e); | 
|---|
|  |  |  | //            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); | 
|---|
|  |  |  | } finally { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | // 保存接口日志 | 
|---|
|  |  |  | apiLogService.save( | 
|---|
|  |  |  | "轮询数据", | 
|---|
|  |  |  | URL + inaddress, | 
|---|
|  |  |  | null, | 
|---|
|  |  |  | "127.0.0.1", | 
|---|
|  |  |  | add, | 
|---|
|  |  |  | response, | 
|---|
|  |  |  | success | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | log.error("", e); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok("订单添加成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | DocType docType= docTypeService.selectById(docName); | 
|---|
|  |  |  | //单据状态 | 
|---|
|  |  |  | FDocumentStatus="B"; | 
|---|
|  |  |  | jsonObject.put("FilterString", "FCreateDate>'"+sdf.format(docType.getCreateTime())+"' and FDocumentStatus='"+FDocumentStatus+"'"); | 
|---|
|  |  |  | jsonObject.put("FilterString", "FCreateDate>'"+sdf.format(docType.getCreateTime())+"'and FStockId.Fname='立库'"+"' and FDocumentStatus='"+FDocumentStatus+"'"); | 
|---|
|  |  |  | jsonObject.put("FieldKeys", "FBillNo,FCreateDate,FMaterialId.FNumber,FMaterialId.FName,FMaterialId.FSpecification,"+anfme+",FDocumentStatus"); | 
|---|
|  |  |  | // FBillNo :单据编号; | 
|---|
|  |  |  | // FCreateDate :单据创建时间; | 
|---|
|  |  |  | 
|---|
|  |  |  | .doPost(); | 
|---|
|  |  |  | JSONArray data = JSON.parseArray(response); | 
|---|
|  |  |  | if(data.size()>0){ | 
|---|
|  |  |  | success = true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (data.getJSONArray(0).get(0).toString().length()<20) { | 
|---|
|  |  |  | if(i==0){ | 
|---|
|  |  |  | for (int j = 0; j < data.size(); j++) { | 
|---|
|  |  |  | JSONArray jsonArray = data.getJSONArray(j); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | log.error("fail", e); | 
|---|
|  |  |  | //            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); | 
|---|
|  |  |  | 
|---|
|  |  |  | outaddress: K3CLOUD/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit.common.kdsvc | 
|---|
|  |  |  | #登录账号管理 | 
|---|
|  |  |  | login : | 
|---|
|  |  |  | acctID: "64c7666b20caf2" | 
|---|
|  |  |  | username: "cs" | 
|---|
|  |  |  | acctID: "640ad1fcc2b286" | 
|---|
|  |  |  | username: "立库" | 
|---|
|  |  |  | password: "123456" | 
|---|
|  |  |  | lcid: 2052 | 
|---|
|  |  |  | 
|---|
|  |  |  | case 'addData': | 
|---|
|  |  |  | showEditModel() | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case 'kingAddData': | 
|---|
|  |  |  | KingShowEditModel() | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case 'deleteData': | 
|---|
|  |  |  | var data = checkStatus.data; | 
|---|
|  |  |  | if (data.length === 0){ | 
|---|
|  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function KingShowEditModel(mData) { | 
|---|
|  |  |  | admin.open({ | 
|---|
|  |  |  | type: 1, | 
|---|
|  |  |  | area: '600px', | 
|---|
|  |  |  | title: '指定添加商品', | 
|---|
|  |  |  | content: $('#KingEditDialog').html(), | 
|---|
|  |  |  | success: function (layero, dIndex) { | 
|---|
|  |  |  | // 回显表单数据 | 
|---|
|  |  |  | form.val('detail', mData); | 
|---|
|  |  |  | // 新增自动生成商品编号 | 
|---|
|  |  |  | if (!mData) { | 
|---|
|  |  |  | http.get(baseUrl + "/mat/auto/matnr/auth", null, function (res) { | 
|---|
|  |  |  | $('#matnr1').val(res.data); | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | console.log("----------------------------------") | 
|---|
|  |  |  | // 表单提交事件 | 
|---|
|  |  |  | form.on('submit(editSubmit1)', function (data) { | 
|---|
|  |  |  | console.log(data) | 
|---|
|  |  |  | data.field.tagId = 20; | 
|---|
|  |  |  | var loadIndex = layer.load(2); | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl+"/mat/KingDeeadd/auth", | 
|---|
|  |  |  | headers: {'token': localStorage.getItem('token')}, | 
|---|
|  |  |  | data: data.field, | 
|---|
|  |  |  | method: 'POST', | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | layer.close(loadIndex); | 
|---|
|  |  |  | if (res.code === 200){ | 
|---|
|  |  |  | layer.close(dIndex); | 
|---|
|  |  |  | layer.msg(res.msg, {icon: 1}); | 
|---|
|  |  |  | $(".layui-laypage-btn")[0].click(); | 
|---|
|  |  |  | } else if (res.code === 403){ | 
|---|
|  |  |  | top.location.href = baseUrl+"/"; | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | layer.msg(res.msg, {icon: 2}); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | // 渲染下拉树 | 
|---|
|  |  |  | var insXmSel = xmSelect.render({ | 
|---|
|  |  |  | el: '#tagSel', | 
|---|
|  |  |  | height: '250px', | 
|---|
|  |  |  | data: insTb.options.data, | 
|---|
|  |  |  | initValue: mData ? [mData.tagId] : [], | 
|---|
|  |  |  | model: {label: {type: 'text'}}, | 
|---|
|  |  |  | prop: { | 
|---|
|  |  |  | name: 'name', | 
|---|
|  |  |  | value: 'id' | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | radio: true, | 
|---|
|  |  |  | clickClose: true, | 
|---|
|  |  |  | tree: { | 
|---|
|  |  |  | show: true, | 
|---|
|  |  |  | indent: 15, | 
|---|
|  |  |  | strict: false, | 
|---|
|  |  |  | expandedKeys: true | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | // 弹窗不出现滚动条 | 
|---|
|  |  |  | $(layero).children('.layui-layer-content').css('overflow', 'visible'); | 
|---|
|  |  |  | layui.form.render('select'); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 模板选择 | 
|---|
|  |  |  | form.on('radio(selectTemplateRadio)', function (data) { | 
|---|
|  |  |  | $('.template-preview').hide(); | 
|---|
|  |  |  | 
|---|
|  |  |  | showEditModel(); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 添加指定订单 | 
|---|
|  |  |  | $("#KingOrderAddBtn").click(function () { | 
|---|
|  |  |  | KingShowEditModel(); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 工具条点击事件 | 
|---|
|  |  |  | table.on('tool(order)', function (obj) { | 
|---|
|  |  |  | var data = obj.data; | 
|---|
|  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function KingShowEditModel(expTpe) { | 
|---|
|  |  |  | console.log(expTpe) | 
|---|
|  |  |  | admin.open({ | 
|---|
|  |  |  | type: 1, | 
|---|
|  |  |  | title: '添加指定单据', | 
|---|
|  |  |  | content: $('#KingEditDialog').html(), | 
|---|
|  |  |  | area: '1300px', | 
|---|
|  |  |  | success: function (layero, dIndex) { | 
|---|
|  |  |  | $(layero).children('.layui-layer-content').css('overflow', 'visible'); | 
|---|
|  |  |  | var isExpAdd = !expTpe; | 
|---|
|  |  |  | // 回显数据 | 
|---|
|  |  |  | form.val('KingEditForm', expTpe); | 
|---|
|  |  |  | if (expTpe) { | 
|---|
|  |  |  | $('#orderNo').attr("disabled", "disabled"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 表单提交事件 | 
|---|
|  |  |  | form.on('submit(orderEditSubmit1)', function (data) { | 
|---|
|  |  |  | let nList = admin.util.deepClone(xxDataList); | 
|---|
|  |  |  | layer.load(2); | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl+"/order/form/KingDeeadd/authtest", | 
|---|
|  |  |  | 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', | 
|---|
|  |  |  | method: 'POST', | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | layer.closeAll('loading'); | 
|---|
|  |  |  | 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}); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | // 明细表格 | 
|---|
|  |  |  | var xxDataList = []; | 
|---|
|  |  |  | var tbOptions = { | 
|---|
|  |  |  | elem: '#formSSXMTable', | 
|---|
|  |  |  | 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}, | 
|---|
|  |  |  | // {field: 'unit', title: '单位', width: 80}, | 
|---|
|  |  |  | {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'); | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | size: '' | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | if (!isExpAdd) { | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | 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){ | 
|---|
|  |  |  | xxDataList = res.data; | 
|---|
|  |  |  | tbOptions.data = xxDataList; | 
|---|
|  |  |  | } else if (res.code === 403){ | 
|---|
|  |  |  | top.location.href = baseUrl+"/"; | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | layer.msg(res.msg, {icon: 2}) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | var insTbSSXM = table.render(tbOptions); | 
|---|
|  |  |  | // 工具条点击事件 | 
|---|
|  |  |  | table.on('tool(formSSXMTable)', function (obj) { | 
|---|
|  |  |  | var data = obj.data; | 
|---|
|  |  |  | var layEvent = obj.event; | 
|---|
|  |  |  | if (layEvent === 'edit') { | 
|---|
|  |  |  | showEditModel2(data); | 
|---|
|  |  |  | } else if (layEvent === 'del') { | 
|---|
|  |  |  | if(data.workQty > 0){ | 
|---|
|  |  |  | layer.msg("已存在作业数量,不能删除", {icon: 2}); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | layer.confirm('确定要删除吗?', { | 
|---|
|  |  |  | shade: .1, | 
|---|
|  |  |  | skin: 'layui-layer-admin' | 
|---|
|  |  |  | }, function (i) { | 
|---|
|  |  |  | layer.close(i); | 
|---|
|  |  |  | for (var j = 0; j < xxDataList.length; j++) { | 
|---|
|  |  |  | if (xxDataList[j].matnr === data.matnr && xxDataList[j].batch === data.batch) { | 
|---|
|  |  |  | xxDataList.splice(j, 1); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | insTbSSXM.reload({data: xxDataList, page: {curr: 1}}); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | // 明细数据修改 | 
|---|
|  |  |  | table.on('edit(formSSXMTable)', function (obj) { | 
|---|
|  |  |  | let index = obj.tr.attr("data-index"); | 
|---|
|  |  |  | let data = xxDataList[index]; | 
|---|
|  |  |  | if (obj.field === 'anfme'){ | 
|---|
|  |  |  | let vle = Number(obj.value); | 
|---|
|  |  |  | if (isNaN(vle)) { | 
|---|
|  |  |  | layer.msg("请输入数字", {icon: 2}); | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | if (vle <= 0) { | 
|---|
|  |  |  | layer.msg("数量必须大于零", {icon: 2}); | 
|---|
|  |  |  | // data[obj.field] = 0; | 
|---|
|  |  |  | // insTbSSXM.reload({data: xxDataList}); | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(obj.value < data.workQty){ | 
|---|
|  |  |  | layer.msg("输入数量不能小于作业中数量", {icon: 2}); | 
|---|
|  |  |  | // data[obj.field] = 0; | 
|---|
|  |  |  | // insTbSSXM.reload({data: xxDataList}); | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | data[obj.field] = obj.value; | 
|---|
|  |  |  | insTbSSXM.reload({data: xxDataList}); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | $('#matAddBtnComment').click(function () { | 
|---|
|  |  |  | showEditModel2(); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 显示添加明细表单弹窗 | 
|---|
|  |  |  | function showEditModel2(exp) { | 
|---|
|  |  |  | admin.open({ | 
|---|
|  |  |  | type: 1, | 
|---|
|  |  |  | offset: '150px', | 
|---|
|  |  |  | area: '680px', | 
|---|
|  |  |  | title: (exp ? '修改' : '添加') + '明细', | 
|---|
|  |  |  | content: $('#matEditDialog').html(), | 
|---|
|  |  |  | success: function (layero, dIndex) { | 
|---|
|  |  |  | // 回显数据 | 
|---|
|  |  |  | form.val('matEditForm', exp); | 
|---|
|  |  |  | // 表单提交事件 | 
|---|
|  |  |  | form.on('submit(matEditSubmit)', function (data) { | 
|---|
|  |  |  | let selectList = matXmSelect.getValue(); | 
|---|
|  |  |  | 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')}, | 
|---|
|  |  |  | method: 'GET', | 
|---|
|  |  |  | async: false, | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | 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}) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | layer.close(dIndex); | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | // 渲染物料选择 | 
|---|
|  |  |  | var matXmSelect = xmSelect.render({ | 
|---|
|  |  |  | el: '#mat', | 
|---|
|  |  |  | style: { | 
|---|
|  |  |  | width: '340px', | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | autoRow: true, | 
|---|
|  |  |  | toolbar: { show: true }, | 
|---|
|  |  |  | filterable: true, | 
|---|
|  |  |  | remoteSearch: true, | 
|---|
|  |  |  | remoteMethod: function(val, cb, show){ | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl+"/mat/all/get/kv", | 
|---|
|  |  |  | headers: {'token': localStorage.getItem('token')}, | 
|---|
|  |  |  | data: { | 
|---|
|  |  |  | condition: val | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | method: 'POST', | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | if (res.code === 200){ | 
|---|
|  |  |  | cb(res.data) | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | cb([]); | 
|---|
|  |  |  | layer.msg(res.msg, {icon: 2}); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 弹窗不出现滚动条 | 
|---|
|  |  |  | $(layero).children('.layui-layer-content').css('overflow', 'visible'); | 
|---|
|  |  |  | layui.form.render('select'); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 删除单据 | 
|---|
|  |  |  | function doDel(orderId) { | 
|---|
|  |  |  | layer.confirm('确定要删除吗?', { | 
|---|
|  |  |  | 
|---|
|  |  |  | <button class="layui-btn layui-btn-sm" id="btn-print-batch" lay-event="btnPrintBatch">批量打印</button> | 
|---|
|  |  |  | <button class="layui-btn layui-btn-sm layui-btn-normal" id="btn-add" lay-event="addData">新增</button> | 
|---|
|  |  |  | <button class="layui-btn layui-btn-sm layui-btn-danger" id="btn-delete" lay-event="deleteData">删除</button> | 
|---|
|  |  |  | <button class="layui-btn layui-btn-sm layui-btn-normal" id="king-btn-add" lay-event="kingAddData">添加指定物料</button> | 
|---|
|  |  |  | <!-- 商品/物料 数据中心 --> | 
|---|
|  |  |  | <div class="dropdown-menu" style="float: right"> | 
|---|
|  |  |  | <button class="layui-btn layui-btn-primary layui-border-black icon-btn layui-btn-sm"> 数据同步 <i class="layui-icon layui-icon-drop"></i></button> | 
|---|
|  |  |  | 
|---|
|  |  |  | <script type="text/javascript" src="../../static/js/tagTree.js" charset="utf-8"></script> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!-- 表单弹窗 --> | 
|---|
|  |  |  | <script type="text/html" id="KingEditDialog"> | 
|---|
|  |  |  | <form id="KingDetail" lay-filter="detail" class="layui-form admin-form"> | 
|---|
|  |  |  | <input name="id" type="hidden"> | 
|---|
|  |  |  | <input name="uuid" type="hidden"> | 
|---|
|  |  |  | <input name="nodeId" type="hidden"> | 
|---|
|  |  |  | <input name="tag_id" type="hidden"> | 
|---|
|  |  |  | <input name="model" type="hidden"> | 
|---|
|  |  |  | <input name="name" type="hidden"> | 
|---|
|  |  |  | <input name="batch" type="hidden"> | 
|---|
|  |  |  | <input name="docId" type="hidden"> | 
|---|
|  |  |  | <input name="docNum" type="hidden"> | 
|---|
|  |  |  | <input name="custName" type="hidden"> | 
|---|
|  |  |  | <input name="itemNum" type="hidden"> | 
|---|
|  |  |  | <input name="count" type="hidden"> | 
|---|
|  |  |  | <input name="weight" type="hidden"> | 
|---|
|  |  |  | <input name="status" type="hidden"> | 
|---|
|  |  |  | <input name="createBy" type="hidden"> | 
|---|
|  |  |  | <input name="updateTime$" type="hidden"> | 
|---|
|  |  |  | <input name="updateBy" type="hidden"> | 
|---|
|  |  |  | <div class="layui-row"> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <div class="layui-col-md6"> | 
|---|
|  |  |  | <div class="layui-form-item"> | 
|---|
|  |  |  | <label class="layui-form-label layui-form-required">商品编号</label> | 
|---|
|  |  |  | <div class="layui-input-block"> | 
|---|
|  |  |  | <input id="matnr1" name="matnr" placeholder="请输入商品编号" class="layui-input" lay-vertype="tips" lay-verify="required" required=""> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <hr class="layui-bg-gray"> | 
|---|
|  |  |  | <div class="layui-form-item text-right"> | 
|---|
|  |  |  | <button class="layui-btn" lay-filter="editSubmit1" lay-submit="">保存</button> | 
|---|
|  |  |  | <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </form> | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <script type="text/html" id="editDialog"> | 
|---|
|  |  |  | <form id="detail" lay-filter="detail" class="layui-form admin-form"> | 
|---|
|  |  |  | <input name="id" type="hidden"> | 
|---|
|  |  |  | 
|---|
|  |  |  | </button> | 
|---|
|  |  |  | <button id="orderAddBtn" class="layui-btn icon-btn btn-add"><i class="layui-icon"></i>添加 | 
|---|
|  |  |  | </button> | 
|---|
|  |  |  | <button id="KingOrderAddBtn" class="layui-btn icon-btn btn-add"><i class="layui-icon"></i>添加指定订单 | 
|---|
|  |  |  | </button> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </form> | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!-- 表单弹窗 --> | 
|---|
|  |  |  | <script type="text/html" id="KingEditDialog"> | 
|---|
|  |  |  | <form id="KingEditForm" lay-filter="editForm" class="layui-form model-form"> | 
|---|
|  |  |  | <input name="id" type="hidden"/> | 
|---|
|  |  |  | <div class="layui-form-item"> | 
|---|
|  |  |  | <label class="layui-form-label">单据类型:</label> | 
|---|
|  |  |  | <div class="layui-input-block cool-auto-complete"> | 
|---|
|  |  |  | <input class="layui-input" name="docType" placeholder="请输入单据类型" style="display: none"> | 
|---|
|  |  |  | <input id="docType$" name="docType$" class="layui-input cool-auto-complete-div" onclick="autoShow(this.id)" type="text" placeholder="请输入单据类型" onfocus=this.blur() lay-verType="tips" lay-verify="required"> | 
|---|
|  |  |  | <div class="cool-auto-complete-window"> | 
|---|
|  |  |  | <input class="cool-auto-complete-window-input" data-key="docTypeQueryBydocType" onkeyup="autoLoad(this.getAttribute('data-key'))"> | 
|---|
|  |  |  | <select class="cool-auto-complete-window-select" data-key="docTypeQueryBydocTypeSelect" onchange="confirmed(this.getAttribute('data-key'))" multiple="multiple"> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-form-item"> | 
|---|
|  |  |  | <label class="layui-form-label">单据编号:</label> | 
|---|
|  |  |  | <div class="layui-input-block"> | 
|---|
|  |  |  | <input id="orderNo" name="orderNo" placeholder="输入单据编号" type="text" class="layui-input" maxlength="20" lay-verType="tips" /> | 
|---|
|  |  |  | <!--                lay-verify="required"--> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-form-item text-right"> | 
|---|
|  |  |  | <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button> | 
|---|
|  |  |  | <button class="layui-btn" lay-filter="orderEditSubmit1" lay-submit>保存</button> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </form> | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!-- 表格操作列 --> | 
|---|
|  |  |  | <script type="text/html" id="formSSXMTableBar"> | 
|---|
|  |  |  | <!--    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="edit">修改</a>--> | 
|---|