| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.core.annotations.AppAuth; |
| | | import com.core.common.*; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.param.*; |
| | | import com.zy.asrs.service.OpenService; |
| | | import com.zy.common.model.DetlDto; |
| | | import com.zy.common.web.BaseController; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * Created by vincent on 2022/4/8 |
| | |
| | | } |
| | | } |
| | | |
| | | @PostMapping("/mat/v1") |
| | | @PostMapping("/order/matSync/default/v1") |
| | | public synchronized R syncMatInfoU8(@RequestHeader(required = false) String appkey, |
| | | @RequestBody(required = false) MatSyncParam param, |
| | | @RequestBody(required = false) Map<String, Object> param, |
| | | HttpServletRequest request){ |
| | | auth(appkey, param, request); |
| | | if (Cools.isEmpty(param)) { |
| | | return R.parse(BaseRes.PARAM); |
| | | } |
| | | |
| | | return R.ok(); |
| | | int MsgT = 0; |
| | | int MsgF = 0; |
| | | StringBuilder Msg= new StringBuilder("原因:"); |
| | | |
| | | List<MatInfoParam> matDetails = (List<MatInfoParam>) param.get("matDetails"); |
| | | |
| | | for (Object matDetail : matDetails){ |
| | | MatInfoParam matInfoParam = JSONObject.parseObject(JSON.toJSONString(matDetail),MatInfoParam.class); |
| | | if (Cools.isEmpty(matDetails)) { |
| | | MsgF++; |
| | | continue; |
| | | } |
| | | openService.syncMat(matInfoParam); |
| | | if(matInfoParam.isType()){ |
| | | MsgT++; |
| | | }else { |
| | | MsgF++; |
| | | Msg.append(matInfoParam.getCinvcode()).append(":").append(matInfoParam.getMemo()).append(";"); |
| | | } |
| | | } |
| | | |
| | | if (MsgF==0){ |
| | | return R.ok("成功接收物料:"+MsgT+"个"); |
| | | }else if (MsgT==0){ |
| | | return R.ok("接收物料失败:"+MsgF+"个;"+Msg); |
| | | }else { |
| | | return R.ok("成功接收物料:"+MsgT+"个;"+"接收物料失败:"+MsgF+"个;"+Msg); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | // 1 |
| | | System.out.println("======================================"); |
| | | OpenOrderPakinParam param = new OpenOrderPakinParam(); |
| | | param.setOrderNo(String.valueOf(new SnowflakeIdWorker().nextId())); |
| | | param.setOrderType("打包上线单"); |
| | | param.setOrderTime(DateUtils.convert(new Date())); |
| | | List<DetlDto> orderDetails = new ArrayList<>(); |
| | | param.setOrderDetails(orderDetails); |
| | | for (int i = 0; i < 3; i++) { |
| | | DetlDto detlDto = new DetlDto(); |
| | | switch (i) { |
| | | case 0: |
| | | detlDto.setMatnr("MDH020030530"); |
| | | detlDto.setBatch("500"); |
| | | detlDto.setAnfme(18.0); |
| | | break; |
| | | case 1: |
| | | detlDto.setMatnr("MDH020016416"); |
| | | detlDto.setBatch("500"); |
| | | detlDto.setAnfme(32.0); |
| | | break; |
| | | case 2: |
| | | detlDto.setMatnr("LSH90152025"); |
| | | detlDto.setAnfme(50.0); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | orderDetails.add(detlDto); |
| | | @PostMapping("/order/pakin/default/v1") |
| | | @AppAuth(memo = "生成入库单据") |
| | | public synchronized R orderPakin(@RequestHeader(required = false) String appkey, |
| | | @RequestBody(required = false) Map<String, Object> param, |
| | | HttpServletRequest request){ |
| | | auth(appkey, param, request); |
| | | if (Cools.isEmpty(param)) { |
| | | return R.parse(BaseRes.PARAM); |
| | | } |
| | | System.out.println(JSON.toJSONString(param)); |
| | | // 2 |
| | | System.out.println("======================================"); |
| | | OpenOrderCompleteParam param1 = new OpenOrderCompleteParam(); |
| | | param1.setOrderNo("963001846497017856"); |
| | | System.out.println(JSON.toJSONString(param1)); |
| | | |
| | | openService.syncOrder(param); |
| | | |
| | | return R.ok("入库单据接受成功"); |
| | | |
| | | } |
| | | |
| | | @PostMapping("/order/pakout/default/v1") |
| | | @AppAuth(memo = "生成出库单据") |
| | | public synchronized R orderPakout(@RequestHeader(required = false) String appkey, |
| | | @RequestBody(required = false) Map<String, Object> param, |
| | | HttpServletRequest request){ |
| | | |
| | | auth(appkey, param, request); |
| | | if (Cools.isEmpty(param)) { |
| | | return R.parse(BaseRes.PARAM); |
| | | } |
| | | |
| | | openService.syncOrder(param); |
| | | |
| | | return R.ok("出库单据接受成功"); |
| | | |
| | | } |
| | | |
| | | @PostMapping("/order/delete/default/v1") |
| | | @AppAuth(memo = "单据删除审核") |
| | | public synchronized R orderDelete(@RequestHeader(required = false) String appkey, |
| | | @RequestBody(required = false) Map<String, Object> param, |
| | | HttpServletRequest request){ |
| | | auth(appkey, param, request); |
| | | if (Cools.isEmpty(param)) { |
| | | return R.parse(BaseRes.PARAM); |
| | | } |
| | | |
| | | boolean success = openService.orderDelete(param.get("id").toString()); |
| | | |
| | | if(success){ |
| | | return R.ok("单据删除成功"); |
| | | }else { |
| | | return R.error("单据正在执行,删除失败"); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | @Transactional |
| | | public R delete(@RequestParam Long orderId){ |
| | | orderService.remove(orderId); |
| | | // Order order = orderService.selectById(orderId); |
| | | // if (order != null) { |
| | | // order.setStatus(0); |
| | | // } |
| | | // if (!orderService.updateById(order)) { |
| | | // throw new CoolException("删除订单失败"); |
| | | // } |
| | | // orderDetlService.modifyStatus(orderId, 0); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/order/report/auth") |
| | | @ManagerAuth(memo = "手动上传订单") |
| | | @Transactional |
| | | public R report(@RequestParam Long orderId){ |
| | | orderService.report(orderId,getUserId()); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | @TableField("store_max_date") |
| | | private Integer storeMaxDate; |
| | | |
| | | //启动日期 |
| | | @TableField("ds_date") |
| | | private Date dsDate; |
| | | |
| | | //建档日期 |
| | | @TableField("d_inv_create_datetime") |
| | | private Date dInvCreateDatetime; |
| | | |
| | | public Mat() {} |
| | | |
| | | public Mat(String uuid, Long tagId, String matnr, String maktx, String name, String specs, String model, String color, String brand, String unit, Double price, String sku, Double units, String barcode, String origin, String manu, String manuDate, String itemNum, Double safeQty, Double weight, Double length, Double volume, String threeCode, String supp, String suppCode, Integer beBatch, String deadTime, Integer deadWarn, Integer source, Integer inspect, Integer danger, Integer status, Long createBy, Date createTime, Long updateBy, Date updateTime, String memo, Double storeMax, Double storeMin, Integer storeMaxDate) { |
| | |
| | | 通用型号 |
| | | */ |
| | | private String cinvdefine4; |
| | | |
| | | private boolean type; |
| | | |
| | | private String memo; |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | import com.zy.asrs.entity.result.StockVo; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface OpenService { |
| | | |
| | |
| | | */ |
| | | List<ViewWorkInBean> outlogERP(); |
| | | |
| | | /** |
| | | * 同步商品信息 |
| | | * @param param |
| | | */ |
| | | boolean syncMat(MatInfoParam param); |
| | | |
| | | /** |
| | | * 生成出入库单据 |
| | | * @param param |
| | | */ |
| | | boolean syncOrder(Map<String, Object> param); |
| | | |
| | | /** |
| | | * 生成出入库单据 |
| | | */ |
| | | boolean orderDelete(String orderNo); |
| | | |
| | | } |
| | |
| | | |
| | | void remove(Long orderId); |
| | | |
| | | void report(Long orderId, Long userId); |
| | | |
| | | List<Order> selectComplete(); |
| | | |
| | | /** |
| | |
| | | import com.zy.asrs.mapper.ReportQueryMapper; |
| | | import com.zy.asrs.mapper.TagMapper; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.asrs.task.handler.WorkLogHandler; |
| | | import com.zy.asrs.utils.MatUtils; |
| | | import com.zy.common.model.DetlDto; |
| | | import com.zy.common.utils.ListUtils; |
| | | import com.zy.common.utils.NodeUtils; |
| | | 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.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * Created by vincent on 2022/4/9 |
| | |
| | | return viewWorkInBeans; |
| | | } |
| | | |
| | | @Transactional |
| | | public boolean syncMat(MatInfoParam param) { |
| | | if(!Cools.isEmpty(matService.selectByMatnr(param.getCinvcode()))){ |
| | | callApiLogSave(param, "/open/asrs/mat/v1", "接收ERP下发商品信息失败!!!商品已存在!!!", false); |
| | | param.setType(false); |
| | | param.setMemo("商品已存在!"); |
| | | return false; |
| | | } |
| | | Date now = new Date(); |
| | | Mat mat = new Mat(); |
| | | //物料号 |
| | | mat.setMatnr(param.getCinvcode()); |
| | | //物料名称 |
| | | mat.setMaktx(param.getCinvname()); |
| | | //规格型号 |
| | | mat.setSpecs(param.getCInvStd()); |
| | | //存货分类编码 |
| | | mat.setBrand(param.getCinvccode()); |
| | | //存货分类名称 |
| | | mat.setColor(param.getCInvCName()); |
| | | //计量单位 |
| | | mat.setUnit(param.getCComUnitName()); |
| | | //进项税 |
| | | mat.setPrice(param.getIImpTaxRate()); |
| | | //销项税 |
| | | mat.setUnits(param.getITaxRate()); |
| | | //启用日期 |
| | | mat.setDsDate(param.getDSDate()); |
| | | //建档人 |
| | | mat.setSupp(param.getCCreatePerson()); |
| | | //建档日期 |
| | | mat.setDInvCreateDatetime(param.getDInvCreateDatetime()); |
| | | //通用型号 |
| | | mat.setModel(param.getCinvdefine4()); |
| | | |
| | | mat.setCreateTime(now); |
| | | mat.setUpdateTime(now); |
| | | |
| | | if (matService.insert(mat)) { |
| | | callApiLogSave(param, "/open/asrs/mat/v1", "接收ERP下发商品信息成功!添加商品信息成功!", true); |
| | | param.setType(true); |
| | | } else { |
| | | callApiLogSave(param, "/open/asrs/mat/v1", "添加ERP下发商品信息失败!!!状态异常!!!", false); |
| | | param.setType(false); |
| | | param.setMemo("添加ERP下发商品信息失败!"); |
| | | } |
| | | |
| | | matService.insert(mat); |
| | | |
| | | return true; |
| | | } |
| | | |
| | | @Transactional |
| | | public boolean syncOrder(Map<String, Object> param) { |
| | | if(Cools.isEmpty(param) || Cools.isEmpty(param.get("orderDetails"))){ |
| | | throw new CoolException("单据参数为空或者单据详情为空,无法生成单据信息"); |
| | | } |
| | | |
| | | if(!Cools.isEmpty(orderService.selectByNo(param.get("id").toString()))){ |
| | | throw new CoolException("该单据已存在,无法生成单据信息"); |
| | | } |
| | | Order order = orderMapping(param); |
| | | orderService.insert(order); |
| | | List<Map<String, Object>> orderDetails = (List<Map<String, Object>>) param.get("orderDetails"); |
| | | orderDetails.forEach(odParam -> { |
| | | OrderDetl od = orderDetlMapping(order.getOrderNo(),odParam); |
| | | orderDetlService.insert(od); |
| | | }); |
| | | |
| | | return true; |
| | | } |
| | | |
| | | @Transactional |
| | | public boolean orderDelete(String orderNo) { |
| | | Order order = orderService.selectByNo(orderNo); |
| | | if(Cools.isEmpty(order)){ |
| | | throw new CoolException("单据不存在,无法删除单据"); |
| | | } |
| | | |
| | | if(order.getSettle() != 1){ |
| | | return false; |
| | | } |
| | | |
| | | orderService.deleteById(order); |
| | | orderDetlService.delete(new EntityWrapper<OrderDetl>().eq("order_no",orderNo)); |
| | | |
| | | return true; |
| | | } |
| | | |
| | | private Order orderMapping(Map<String, Object> param){ |
| | | Date now = new Date(); |
| | | Order order = new Order(); |
| | | //uuid |
| | | order.setUuid(String.valueOf(snowflakeIdWorker.nextId())); |
| | | //核算主体 |
| | | order.setItemName(param.get("account").toString()); |
| | | //单据唯一表示 |
| | | order.setOrderNo(param.get("id").toString()); |
| | | //业务类型 |
| | | order.setDefNumber(param.get("cBusType").toString()); |
| | | //单据类型 |
| | | DocType docType = docTypeService.selectOrAdd(param.get("cVouchType").toString(), Boolean.TRUE); |
| | | order.setDocType(docType.getDocId()); |
| | | //单据日期 |
| | | order.setOrderTime(param.get("dDate").toString()); |
| | | //供应商/客户编码 |
| | | order.setCstmrName(param.get("ks").toString()); |
| | | //仓库 |
| | | order.setTel(param.get("cWhName").toString()); |
| | | //出入库类别 |
| | | order.setOperMemb(param.get("cRdName").toString()); |
| | | //部门 |
| | | order.setSalesman(param.get("cDepCode").toString()); |
| | | //备注 |
| | | order.setMemo(param.get("cMemo").toString()); |
| | | //制单人 |
| | | order.setShipCode(param.get("cMaker").toString()); |
| | | |
| | | order.setCreateTime(now); |
| | | order.setUpdateTime(now); |
| | | |
| | | //订单状态 |
| | | order.setSettle(1L); |
| | | //状态 |
| | | order.setStatus(1); |
| | | return order; |
| | | } |
| | | |
| | | private OrderDetl orderDetlMapping(String orderId, Map<String, Object> odParam){ |
| | | OrderDetl od = new OrderDetl(); |
| | | od.setOrderNo(orderId); |
| | | //行唯一标识 |
| | | od.setItemNum(odParam.get("autoId").toString()); |
| | | //存货编码 |
| | | od.setMatnr(odParam.get("cInvCode").toString()); |
| | | //存货名称 |
| | | od.setMaktx(odParam.get("cInvName").toString()); |
| | | //规格型号 |
| | | od.setSpecs(odParam.get("cInvStd").toString()); |
| | | //计量单位 |
| | | od.setUnit(odParam.get("cComUnitName").toString()); |
| | | //数量 |
| | | od.setAnfme(Double.parseDouble(odParam.get("iQuantity").toString())); |
| | | //行号 |
| | | od.setBrand(odParam.get("irowno").toString()); |
| | | //销售订单号 |
| | | od.setColor(odParam.get("csocode").toString()); |
| | | //销售订单行号 |
| | | od.setOrigin(odParam.get("isoseq").toString()); |
| | | |
| | | return od; |
| | | } |
| | | |
| | | |
| | | public void callApiLogSave(MatInfoParam matParam, String tableName, String response, Boolean bool) { |
| | | apiLogService.save("ERP下发商品信息", tableName, "null", "10.10.10.1", |
| | | "物料编码:" + matParam.getCinvcode() + "、物料名称:" + matParam.getCinvname() + "、规格:" + matParam.getCInvStd() + "、备注:" + matParam.getMemo(), |
| | | response, bool); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.core.common.Cools; |
| | |
| | | import com.zy.common.model.OrderDto; |
| | | import com.zy.common.model.OrderMergeVo; |
| | | import com.zy.common.service.erp.ErpService; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | @Slf4j |
| | | @Service("orderService") |
| | |
| | | private MatService matService; |
| | | @Autowired |
| | | private ErpService erpService; |
| | | @Autowired |
| | | private ApiLogService apiLogService; |
| | | |
| | | @Value("${u8.url}") |
| | | private String url; |
| | | |
| | | @Value("${u8.orderReportPath}") |
| | | private String orderReportPath; |
| | | |
| | | @Override |
| | | public Order selectByNo(String orderNo) { |
| | |
| | | orderDetlService.delete(new EntityWrapper<OrderDetl>().eq("order_id", orderId)); |
| | | } |
| | | |
| | | public void report(Long orderId, Long userId) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | Order order = this.selectById(orderId); |
| | | Map<String, String> param = new HashMap<>(); |
| | | param.put("id",order.getOrderNo()); |
| | | param.put("dDate",sdf.format(new Date())); |
| | | param.put("cHandler",userId.toString()); |
| | | |
| | | int code = doHttpRequest(param, "单据审核", url, orderReportPath, null, "127.0.0.1"); |
| | | //int code = doHttpRequest(param, "单据审核", "localhost:8080", "/test/report", null, "127.0.0.1"); |
| | | if(code == 200){ |
| | | order.setSettle(6L); |
| | | this.updateById(order); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public List<Order> selectComplete() { |
| | | return this.baseMapper.selectComplete(); |
| | |
| | | return this.baseMapper.selectorderNoL(orderNo); |
| | | } |
| | | |
| | | private int doHttpRequest(Object requestParam, String namespace, String url, String path, String appkey, String ip){ |
| | | String response = ""; |
| | | boolean success = false; |
| | | |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | .setUri(url) |
| | | .setPath(path) |
| | | .setJson(JSONObject.toJSONString(requestParam)) |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | |
| | | int code = (int) jsonObject.get("code"); |
| | | if(code != 200){ |
| | | throw new CoolException(jsonObject.get("msg").toString()); |
| | | } |
| | | success = true; |
| | | return code; |
| | | }catch (Exception e){ |
| | | log.error(e.getMessage()); |
| | | throw new CoolException("调用接口响应错误"); |
| | | }finally { |
| | | apiLogService.save( |
| | | namespace, |
| | | url + path, |
| | | appkey, |
| | | ip, |
| | | JSON.toJSONString(JSONObject.toJSONString(requestParam)), |
| | | response, |
| | | success |
| | | ); |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | package com.zy.asrs.task.handler; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.DocType; |
| | | import com.zy.asrs.entity.Order; |
| | | import com.zy.asrs.entity.OrderDetl; |
| | | import com.zy.asrs.service.ApiLogService; |
| | | import com.zy.asrs.service.DocTypeService; |
| | | import com.zy.asrs.service.OrderDetlService; |
| | |
| | | import com.zy.asrs.task.AbstractHandler; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.common.service.erp.ErpService; |
| | | import com.zy.common.service.erp.entity.VoucherDetail; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.jdbc.core.JdbcTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * Created by vincent on 2020/7/7 |
| | |
| | | @Autowired |
| | | private ErpService erpService; |
| | | |
| | | @Value("${u8.url}") |
| | | private String url; |
| | | |
| | | @Value("${u8.orderReportPath}") |
| | | private String orderReportPath; |
| | | |
| | | @Transactional |
| | | public ReturnT<String> start(Order order) { |
| | | DocType docType = docTypeService.selectById(order.getDocType()); |
| | | if (null == docType) { |
| | | return SUCCESS; |
| | | |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("id",order.getOrderNo()); |
| | | param.put("dDate",new Date()); |
| | | param.put("cHandler",9527); |
| | | |
| | | int code = doHttpRequest(param, "单据审核", url, orderReportPath, null, "127.0.0.1"); |
| | | if(code == 200){ |
| | | order.setSettle(6L); |
| | | orderService.updateById(order); |
| | | } |
| | | if (!Cools.isEmpty(docType.getMemo())) { |
| | | if (docType.getMemo().equals("hand")) { |
| | | // 修改订单状态 4.完成 ===>> 6.已上报 |
| | | if (!orderService.updateSettle(order.getId(), 6L, null)) { |
| | | throw new CoolException("服务器内部错误,请联系管理员"); |
| | | } |
| | | return SUCCESS; |
| | | } |
| | | } |
| | | List<OrderDetl> orderDetls = orderDetlService.selectByOrderId(order.getId()); |
| | | |
| | | |
| | | // DocType docType = docTypeService.selectById(order.getDocType()); |
| | | // if (null == docType) { |
| | | // return SUCCESS; |
| | | // } |
| | | // if (!Cools.isEmpty(docType.getMemo())) { |
| | | // if (docType.getMemo().equals("hand")) { |
| | | // // 修改订单状态 4.完成 ===>> 6.已上报 |
| | | // if (!orderService.updateSettle(order.getId(), 6L, null)) { |
| | | // throw new CoolException("服务器内部错误,请联系管理员"); |
| | | // } |
| | | // return SUCCESS; |
| | | // } |
| | | // } |
| | | |
| | | // List<OrderDetl> orderDetls = orderDetlService.selectByOrderId(order.getId()); |
| | | // 入库完成上报 |
| | | if (docType.getPakin() == 1) { |
| | | try { |
| | | // erp 同步 |
| | | int state = 2; |
| | | if (!erpService.updateStateForVoucher(order.getOrderNo(), state)) { |
| | | throw new CoolException(order.getOrderNo() + "订单修改State为"+state+"失败"); |
| | | } else { |
| | | erpService.updateTimeForVoucherDetail(order.getOrderNo()); |
| | | } |
| | | |
| | | // 修改订单状态 4.完成 ===>> 6.已上报 |
| | | if (!orderService.updateSettle(order.getId(), 6L, null)) { |
| | | throw new CoolException("服务器内部错误,请联系管理员"); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | log.error("fail", e); |
| | | return FAIL.setMsg(e.getMessage()); |
| | | } |
| | | } |
| | | // 出库完成上报 |
| | | if (docType.getPakout() == 1) { |
| | | try { |
| | | double TotalNum = 0.0; |
| | | Integer TotalCount = orderDetls.size(); |
| | | // erp 同步 |
| | | int state = 2; |
| | | if (!erpService.updateStateForVoucher(order.getOrderNo(), state)) { |
| | | throw new CoolException(order.getOrderNo() + "订单修改State为"+state+"失败"); |
| | | } else { |
| | | Date now = new Date(); |
| | | for (OrderDetl orderDetl : orderDetls) { |
| | | TotalNum = TotalNum + orderDetl.getAnfme(); |
| | | if (null == erpService.selectVoucherDetail(order.getOrderNo(), orderDetl.getBatch())) { |
| | | VoucherDetail voucherDetail = new VoucherDetail(); |
| | | voucherDetail.setVoucherID(order.getOrderNo()); |
| | | voucherDetail.setPickID("fepvnn0496"); |
| | | voucherDetail.setBarcode(orderDetl.getBatch()); |
| | | voucherDetail.setLastUpdatedDate(DateUtils.convert(now)); |
| | | if (!erpService.insertVoucherDetail(voucherDetail)) { |
| | | throw new CoolException(order.getOrderNo() + "订单添加VoucherDetail"+ JSON.toJSONString(voucherDetail)+"失败"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // 更新重量和数量 |
| | | if (!erpService.updateStateForVoucher(order.getOrderNo(), TotalNum, TotalCount)) { |
| | | throw new CoolException(order.getOrderNo() + "订单修改重量和数量失败"); |
| | | } |
| | | |
| | | // 修改订单状态 4.完成 ===>> 6.已上报 |
| | | if (!orderService.updateSettle(order.getId(), 6L, null)) { |
| | | throw new CoolException("服务器内部错误,请联系管理员"); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | log.error("fail", e); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg(e.getMessage()); |
| | | } |
| | | } |
| | | // if (docType.getPakin() == 1) { |
| | | // try { |
| | | // // erp 同步 |
| | | // int state = 2; |
| | | // if (!erpService.updateStateForVoucher(order.getOrderNo(), state)) { |
| | | // throw new CoolException(order.getOrderNo() + "订单修改State为"+state+"失败"); |
| | | // } else { |
| | | // erpService.updateTimeForVoucherDetail(order.getOrderNo()); |
| | | // } |
| | | // |
| | | // // 修改订单状态 4.完成 ===>> 6.已上报 |
| | | // if (!orderService.updateSettle(order.getId(), 6L, null)) { |
| | | // throw new CoolException("服务器内部错误,请联系管理员"); |
| | | // } |
| | | // |
| | | // } catch (Exception e) { |
| | | // log.error("fail", e); |
| | | // return FAIL.setMsg(e.getMessage()); |
| | | // } |
| | | // } |
| | | // // 出库完成上报 |
| | | // if (docType.getPakout() == 1) { |
| | | // try { |
| | | // double TotalNum = 0.0; |
| | | // Integer TotalCount = orderDetls.size(); |
| | | // // erp 同步 |
| | | // int state = 2; |
| | | // if (!erpService.updateStateForVoucher(order.getOrderNo(), state)) { |
| | | // throw new CoolException(order.getOrderNo() + "订单修改State为"+state+"失败"); |
| | | // } else { |
| | | // Date now = new Date(); |
| | | // for (OrderDetl orderDetl : orderDetls) { |
| | | // TotalNum = TotalNum + orderDetl.getAnfme(); |
| | | // if (null == erpService.selectVoucherDetail(order.getOrderNo(), orderDetl.getBatch())) { |
| | | // VoucherDetail voucherDetail = new VoucherDetail(); |
| | | // voucherDetail.setVoucherID(order.getOrderNo()); |
| | | // voucherDetail.setPickID("fepvnn0496"); |
| | | // voucherDetail.setBarcode(orderDetl.getBatch()); |
| | | // voucherDetail.setLastUpdatedDate(DateUtils.convert(now)); |
| | | // if (!erpService.insertVoucherDetail(voucherDetail)) { |
| | | // throw new CoolException(order.getOrderNo() + "订单添加VoucherDetail"+ JSON.toJSONString(voucherDetail)+"失败"); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // // 更新重量和数量 |
| | | // if (!erpService.updateStateForVoucher(order.getOrderNo(), TotalNum, TotalCount)) { |
| | | // throw new CoolException(order.getOrderNo() + "订单修改重量和数量失败"); |
| | | // } |
| | | // |
| | | // // 修改订单状态 4.完成 ===>> 6.已上报 |
| | | // if (!orderService.updateSettle(order.getId(), 6L, null)) { |
| | | // throw new CoolException("服务器内部错误,请联系管理员"); |
| | | // } |
| | | // |
| | | // } catch (Exception e) { |
| | | // log.error("fail", e); |
| | | // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | // return FAIL.setMsg(e.getMessage()); |
| | | // } |
| | | // } |
| | | return SUCCESS; |
| | | } |
| | | |
| | | private int doHttpRequest(Object requestParam, String namespace, String url, String path, String appkey, String ip){ |
| | | String response = ""; |
| | | boolean success = false; |
| | | |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | .setUri(url) |
| | | .setPath(path) |
| | | .setJson(JSONObject.toJSONString(requestParam)) |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | |
| | | int code = (int) jsonObject.get("code"); |
| | | if(code != 200){ |
| | | throw new CoolException(jsonObject.get("msg").toString()); |
| | | } |
| | | success = true; |
| | | return code; |
| | | }catch (Exception e){ |
| | | log.error(e.getMessage()); |
| | | throw new CoolException("调用接口响应错误"); |
| | | }finally { |
| | | apiLogService.save( |
| | | namespace, |
| | | url + path, |
| | | appkey, |
| | | ip, |
| | | JSON.toJSONString(JSONObject.toJSONString(requestParam)), |
| | | response, |
| | | success |
| | | ); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | url: localhost:8080 |
| | | taskCreatePath: /test/task/create |
| | | containerMoveInPath: /test/container/moveIn |
| | | |
| | | u8: |
| | | url: http://192.168.1.55:8010 |
| | | orderReportPath: /api/RdAudit |
| | |
| | | } |
| | | |
| | | var matCols = [ |
| | | {field: 'matnr', align: 'center',title: '物料号', width: 180} |
| | | ,{field: 'name', align: 'center',title: '移动类型', hide: true} |
| | | ,{field: 'maktx', align: 'center',title: '物料名称', width: 150} |
| | | ,{field: 'specs', align: 'center',title: '规格', hide: false} |
| | | ,{field: 'model', align: 'center',title: '通用型号', hide: true} |
| | | ,{field: 'manuDate', align: 'center',title: '单据时间', hide: false} |
| | | ,{field: 'weight', align: 'center',title: '重量', hide: false} |
| | | ,{field: 'units', align: 'center',title: '支数', hide: false} |
| | | ,{field: 'origin', align: 'center',title: '物料状态', hide: true} |
| | | |
| | | ,{field: 'color', align: 'center',title: '颜色', hide: false} |
| | | ,{field: 'brand', align: 'center',title: '品牌', hide: true} |
| | | ,{field: 'unit', align: 'center',title: '单位', hide: false} |
| | | ,{field: 'price', align: 'center',title: '单价', hide: false} |
| | | ,{field: 'sku', align: 'center',title: 'sku', hide: true} |
| | | ,{field: 'barcode', align: 'center',title: '条码', hide: true} |
| | | ,{field: 'manu', align: 'center',title: '厂家', hide: true} |
| | | ,{field: 'itemNum', align: 'center',title: '品项数', hide: true} |
| | | ,{field: 'safeQty', 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: 'matnr', align: 'center',title: '存货编码', width: 180} |
| | | //,{field: 'name', align: 'center',title: '移动类型', hide: true} |
| | | ,{field: 'maktx', align: 'center',title: '存货名称', width: 150} |
| | | ,{field: 'specs', align: 'center',title: '规格型号', hide: false} |
| | | ,{field: 'model', align: 'center',title: '通用型号', hide: false} |
| | | // ,{field: 'manuDate', align: 'center',title: '单据时间', hide: false} |
| | | // ,{field: 'weight', align: 'center',title: '重量', hide: false} |
| | | // ,{field: 'units', align: 'center',title: '支数', hide: false} |
| | | // ,{field: 'origin', align: 'center',title: '物料状态', hide: true} |
| | | ,{field: 'brand', align: 'center',title: '存货分类编码', hide: true} |
| | | ,{field: 'color', align: 'center',title: '存货分类名称', hide: true} |
| | | ,{field: 'unit', align: 'center',title: '计量单位', hide: true} |
| | | ,{field: 'price', align: 'center',title: '进项税', hide: true} |
| | | ,{field: 'units', align: 'center',title: '销项税', hide: true} |
| | | ,{field: 'dsDate', align: 'center',title: '启用日期', hide: true} |
| | | ,{field: 'supp', align: 'center',title: '建档人', hide: true} |
| | | ,{field: 'dInvCreateDatetime', align: 'center',title: '建档日期', hide: true} |
| | | // ,{field: 'sku', align: 'center',title: 'sku', hide: true} |
| | | // ,{field: 'barcode', align: 'center',title: '条码', hide: true} |
| | | // ,{field: 'manu', align: 'center',title: '厂家', hide: true} |
| | | // ,{field: 'itemNum', align: 'center',title: '品项数', hide: true} |
| | | // ,{field: 'safeQty', 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: 'status$', align: 'center',title: '状态'} |
| | | // ,{field: 'createBy$', align: 'center',title: '添加人员'} |
| | | // ,{field: 'createTime$', align: 'center',title: '添加时间'} |
| | |
| | | cols: [[ |
| | | {type: 'numbers'}, |
| | | {field: 'orderNo', title: '单据编号', templet: '#orderNoTpl'}, |
| | | {field: 'docType$', align: 'center', title: '类型', minWidth: 160, width: 160}, |
| | | {field: 'postFee', align: 'center', title: '总数量', minWidth: 130, width: 130}, |
| | | {field: 'itemName', align: 'center', title: '核算主体'}, |
| | | {field: 'docType$', align: 'center', title: '单据类型'}, |
| | | {field: 'defNumber', align: 'center', title: '业务类型'}, |
| | | //{field: 'postFee', align: 'center', title: '总数量', minWidth: 130, width: 130}, |
| | | {align: 'center', title: '明细', toolbar: '#tbLook', minWidth: 160, width: 160}, |
| | | {field: 'createTime$', title: '创建时间', minWidth: 200, width: 200}, |
| | | {field: 'createTime$', title: '创建时间'}, |
| | | {field: 'settle$', align: 'center', title: '状态', templet: '#settleTpl', minWidth: 160, width: 160}, |
| | | {field: 'memo', align: 'center',title: '备注', hide: true}, |
| | | {field: 'orderTime', align: 'center',title: '单据日期', hide: true}, |
| | | {field: 'cstmrName', align: 'center',title: '供应商/客户编码', hide: true}, |
| | | {field: 'tel', align: 'center',title: '仓库', hide: true}, |
| | | {field: 'operMemb', align: 'center',title: '出入库类别', hide: true}, |
| | | {field: 'salesman', align: 'center',title: '部门', hide: true}, |
| | | {field: 'shipCode', align: 'center',title: '制单人', hide: true}, |
| | | {align: 'center', title: '操作', toolbar: '#operate', width: 180} |
| | | ]], |
| | | request: { |
| | |
| | | doDel(data.id); |
| | | } else if (layEvent === 'complete') { |
| | | doModify(data.id, 4); |
| | | } else if (layEvent === 'report'){ |
| | | doReport(data.id); |
| | | } else if (layEvent === 'look') { |
| | | var $a = $(obj.tr).find('a[lay-event="look"]'); |
| | | var offset = $a.offset(); |
| | |
| | | layer.open({ |
| | | type: 1, |
| | | title: false, |
| | | area: '820px', |
| | | offset: [top + 'px', (left - 530 + $a.outerWidth()) + 'px'], |
| | | area: '1460px', |
| | | offset: [top + 'px', (left - 900 + $a.outerWidth()) + 'px'], |
| | | shade: .01, |
| | | shadeClose: true, |
| | | fixed: false, |
| | |
| | | cellMinWidth: 100, |
| | | cols: [[ |
| | | {type: 'numbers'}, |
| | | {field: 'matnr', title: '物料号', width: 160}, |
| | | {field: 'maktx', title: '物料名称', width: 160}, |
| | | {field: 'batch', title: '序列码'}, |
| | | {field: 'matnr', title: '存货编码', width: 160}, |
| | | {field: 'maktx', title: '存货名称', width: 160}, |
| | | {field: 'batch', title: '批号'}, |
| | | {field: 'anfme', title: '数量'}, |
| | | {field: 'qty', title: '作业数量', style: 'font-weight: bold'}, |
| | | // {field: 'unit', title: '单位'}, |
| | |
| | | // }, |
| | | // {field: 'inQty', title: '已入库量'}, |
| | | // {field: 'color', title: '颜色'}, |
| | | {field: 'specs', title: '规格'} |
| | | {field: 'specs', title: '规格型号'}, |
| | | {field: 'unit', title: '计量单位'}, |
| | | {field: 'brand', title: '行号'}, |
| | | {field: 'color', title: '销售订单号'}, |
| | | {field: 'origin', title: '销售订单行号'}, |
| | | {field: 'itemNum', title: '行唯一标识'} |
| | | ]], |
| | | request: { |
| | | pageName: 'curr', |
| | |
| | | }); |
| | | } |
| | | |
| | | // 上传审核单据 |
| | | function doReport(orderId) { |
| | | layer.confirm('确定要上传单据吗?', { |
| | | shade: .1, |
| | | skin: 'layui-layer-admin' |
| | | }, function (i) { |
| | | layer.close(i); |
| | | layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl+"/order/report/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: { |
| | | orderId: orderId |
| | | }, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.closeAll('loading'); |
| | | if (res.code === 200){ |
| | | if (insTbCount === 0) { |
| | | 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}); |
| | | } |
| | | } |
| | | }) |
| | | }); |
| | | } |
| | | |
| | | // 修改订单状态 |
| | | function doModify(orderId, settle) { |
| | | layer.confirm('确定要手动完结吗?', { |
| | |
| | | {{# } }} |
| | | {{# } }} |
| | | <a class="layui-btn layui-btn-danger layui-btn-xs btn-delete" lay-event="del">删除</a> |
| | | <a class="layui-btn layui-btn-primary layui-btn-xs btn-report" lay-event="report">上报</a> |
| | | </script> |
| | | <!-- 表格操作列 --> |
| | | <script type="text/html" id="tbLook"> |