| | |
| | | |
| | | List<Mat> selectByMatnrLink(@Param("matnr")String matnr); |
| | | |
| | | Mat selectNewUpdateTime(); |
| | | |
| | | List<Mat> getMatTurnPage(Map<String, Object> map); |
| | | |
| | | Integer getStockOutPageCount(Map<String, Object> map); |
| | |
| | | |
| | | Page<Mat> getMatTurnPage(Page<Mat> page); |
| | | |
| | | Mat selectNewUpdateTime(); |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Mat selectNewUpdateTime() { |
| | | return this.baseMapper.selectNewUpdateTime(); |
| | | } |
| | | |
| | | @Override |
| | | public Page<Mat> getMatTurnPage(Page<Mat> page){ |
| | | page.setRecords(baseMapper.getMatTurnPage(page.getCondition())); |
| | | // page.setTotal(baseMapper.getStockOutPageCount(page.getCondition())); |
| | |
| | | for(KingDeeUtilType kingDeeUtilType : KingDeeUtilType.values()) { |
| | | InFormIdParam inFormIdParam = new InFormIdParam(); |
| | | DocType docType = docTypeService.selectOne(new EntityWrapper<DocType>().eq("doc_name", kingDeeUtilType.desc)); |
| | | if (Cools.isEmpty(docType)){ |
| | | docType = docTypeService.selectOrAdd(kingDeeUtilType.desc, kingDeeUtilType.pakIn.equals(1)); |
| | | } |
| | | inFormIdParam.setFormId(kingDeeUtilType.formId); |
| | | inFormIdParam.setLimit(100); |
| | | inFormIdParam.setStartRow("0"); |
| | |
| | | jsonObject.put("StartRow", inFormIdParam.getStartRow()); |
| | | //物料档案查询 |
| | | if(inFormIdParam.getFormId().equals("BD_MATERIAL")){ |
| | | Tag tag = tagService.selectById(20); |
| | | //最新时间 |
| | | Date time=tag.getCreateTime(); |
| | | Tag tag = tagService.selectByName("全部", 1); |
| | | //物料状态 FUseOrgId .FNumber |
| | | FDocumentStatus="C"; |
| | | jsonObject.put("FilterString", "FCreateDate>'"+sdf.format(time)+"' and FDocumentStatus='"+FDocumentStatus+"' and FUseOrgId .FNumber='201'"); |
| | | jsonObject.put("FilterString", "FCreateDate>'"+sdf.format(tag.getUpdateTime())+"' and FDocumentStatus='"+FDocumentStatus+"' and FUseOrgId .FNumber='201'"); |
| | | jsonObject.put("FieldKeys", "FName,FNumber,FCreateDate,FSpecification,FDocumentStatus"); |
| | | // FName : 物料名称 ; |
| | | // FNumber :物料编号; |
| | |
| | | if(data.size()<=0) continue; |
| | | if (data.getJSONArray(0).get(0).toString().length()>=20) continue; |
| | | if (kingDeeUtilType.formId.equals("BD_MATERIAL")) {//物料档案 |
| | | Tag tag = tagService.selectByName("全部", 1); |
| | | for (int j = 0; j < data.size(); j++) { |
| | | JSONArray jsonArray = data.getJSONArray(j); |
| | | //对美国时间进行转换 |
| | | Date date = KingDeeUtil.KingDeeDate(jsonArray.get(2).toString()); |
| | | //生成商品档案 |
| | | //商品编号 |
| | | Mat 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); |
| | | //对美国时间进行转换 |
| | | Date date = KingDeeUtil.KingDeeDate(jsonArray.get(2).toString()); |
| | | mat.setTagId(tag.getId()); |
| | | 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("服务器内部错误,请联系管理员"); |
| | | log.info("同步新物料出错!!!参数:[{}]、[{}]",mat,jsonArray); |
| | | } else { |
| | | log.info("同步新物料[商品编号:{}]", mat.getMatnr()); |
| | | } |
| | | }else { |
| | | log.info("同步新物料[商品编号:{}],商品编号重复!!!", mat.getMatnr()); |
| | | } |
| | | tag.setUpdateTime(date); |
| | | } |
| | | tagService.updateById(tag); |
| | | } else { |
| | | for (int j = 0; j < data.size(); j++) { |
| | | JSONArray jsonArray = data.getJSONArray(j); |
| | |
| | | package com.zy.erp.kingdee.enums; |
| | | |
| | | public enum KingDeeUtilType { |
| | | BD_MATERIAL(0, "物料档案","BD_MATERIAL",""), |
| | | STK_InStock(1, "采购入库","STK_InStock","FRealQty"), |
| | | PUR_MRB(2, "采购退料","PUR_MRB","FRMREALQTY"), |
| | | PRD_PickMtrl(3, "生产领料","PRD_PickMtrl","FActualQty"), |
| | | PRD_ReturnMtrl(4, "生产退料","PRD_ReturnMtrl","FQty"), |
| | | PRD_FeedMtrl(5, "生产补料","PRD_FeedMtrl","FActualQty"), |
| | | STK_TransferDirect(6, "直接调拨单","STK_TransferDirect","FQty"), |
| | | STK_StockCountGain(7, "盘盈单","STK_StockCountGain","FGainQty"), |
| | | STK_StockCountLoss(8, "盘亏单","STK_StockCountLoss","FLossQty"), |
| | | STK_MisDelivery(9, "其他出库","STK_MisDelivery","FQty"), |
| | | SP_PickMtrl(10, "简单生产领料","SP_PickMtrl","FActualQty"), |
| | | SP_ReturnMtrl(11, "简单生产退料","SP_ReturnMtrl","FQty"), |
| | | SAL_OUTSTOCK(12, "销售出库","SAL_OUTSTOCK","FRealQty"), |
| | | SAL_RETURNSTOCK(13, "销售退货","SAL_RETURNSTOCK","FRealQty"), |
| | | SAL_DELIVERYNOTICE(14, "发货通知单","SAL_DELIVERYNOTICE",""), |
| | | STK_MISCELLANEOUS(15, "其他入库单","STK_MISCELLANEOUS",""), |
| | | BD_Supplier(16, "供应商","BD_Supplier",""), |
| | | BD_MATERIAL(0, "物料档案","BD_MATERIAL","","",1), |
| | | STK_InStock(1, "采购入库","STK_InStock","FRealQty","",1), |
| | | PUR_MRB(2, "采购退料","PUR_MRB","FRMREALQTY","",1), |
| | | PRD_PickMtrl(3, "生产领料","PRD_PickMtrl","FActualQty","",1), |
| | | PRD_ReturnMtrl(4, "生产退料","PRD_ReturnMtrl","FQty","",1), |
| | | PRD_FeedMtrl(5, "生产补料","PRD_FeedMtrl","FActualQty","",1), |
| | | STK_TransferDirect(6, "直接调拨单","STK_TransferDirect","FQty","",1), |
| | | STK_StockCountGain(7, "盘盈单","STK_StockCountGain","FGainQty","",1), |
| | | STK_StockCountLoss(8, "盘亏单","STK_StockCountLoss","FLossQty","",1), |
| | | STK_MisDelivery(9, "其他出库","STK_MisDelivery","FQty","",1), |
| | | SP_PickMtrl(10, "简单生产领料","SP_PickMtrl","FActualQty","",1), |
| | | SP_ReturnMtrl(11, "简单生产退料","SP_ReturnMtrl","FQty","",1), |
| | | SAL_OUTSTOCK(12, "销售出库","SAL_OUTSTOCK","FRealQty","",1), |
| | | SAL_RETURNSTOCK(13, "销售退货","SAL_RETURNSTOCK","FRealQty","",1), |
| | | SAL_DELIVERYNOTICE(14, "发货通知单","SAL_DELIVERYNOTICE","","",1), |
| | | STK_MISCELLANEOUS(15, "其他入库单","STK_MISCELLANEOUS","","",1), |
| | | BD_Supplier(16, "供应商","BD_Supplier","","",1), |
| | | ; |
| | | public Integer id; |
| | | public String desc; |
| | | public String formId; |
| | | public String anfme; |
| | | public String correspondingFormId; |
| | | public Integer pakIn; |
| | | |
| | | KingDeeUtilType(Integer id, String desc,String formId,String anfme){ |
| | | KingDeeUtilType(Integer id, String desc,String formId,String anfme,String correspondingFormId,int pakIn){ |
| | | this.id = id; |
| | | this.desc = desc; |
| | | this.formId = formId; |
| | | this.anfme = anfme; |
| | | this.correspondingFormId = correspondingFormId; |
| | | this.pakIn = pakIn; //1入库 0出库 |
| | | } |
| | | |
| | | public static KingDeeUtilType get(Short id) { |
| | |
| | | erp: |
| | | # 开关 |
| | | switch: |
| | | InboundOrderSwitch: false |
| | | InboundOrderSwitch: true |
| | | LoginAuthenticationSwitch: false |
| | | ReviewOrderSwitch: false |
| | | # 地址 |
| | |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="selectNewUpdateTime" resultMap="BaseResultMap"> |
| | | select top 1 * from man_mat |
| | | where 1=1 |
| | | ORDER BY create_time ASC |
| | | -- ORDER BY update_time DESC |
| | | </select> |
| | | |
| | | <select id="getMatTurnPage" resultMap="BaseResultMap"> |
| | | select * from |
| | | ( |