转库出库初步完成,生成单据也成功了;显示需要添加菜单及其权限
| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | 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.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.DocType; |
| | | import com.zy.asrs.entity.BasWrkIotype; |
| | | import com.zy.asrs.entity.StoreType; |
| | | import com.zy.asrs.service.StoreTypeService; |
| | | import com.zy.common.web.BaseController; |
| | |
| | | @Autowired |
| | | private StoreTypeService storeTypeService; |
| | | |
| | | @RequestMapping(value = "/storeType/{id}/auth") |
| | | @RequestMapping(value = "/store/{id}/auth") |
| | | @ManagerAuth |
| | | public R get(@PathVariable("id") String id) { |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok(storeTypeService.selectById(String.valueOf(id))); |
| | | } |
| | | |
| | | @RequestMapping(value = "/storeType/list/auth") |
| | | @RequestMapping(value = "/store/list/auth") |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam(required = false) String orderByField, |
| | | @RequestParam(required = false) String orderByType, |
| | | @RequestParam Map<String, Object> param) { |
| | | EntityWrapper<StoreType> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | EntityWrapper<StoreType> wrapper = new EntityWrapper<>(); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | |
| | | } |
| | | } |
| | | |
| | | @RequestMapping(value = "/storeType/add/auth") |
| | | @RequestMapping(value = "/store/edit/auth") |
| | | @ManagerAuth |
| | | public R add(StoreType docType) { |
| | | docType.setStatus(1); |
| | | docType.setCreateBy(getUserId()); |
| | | docType.setCreateTime(new Date()); |
| | | docType.setUpdateBy(getUserId()); |
| | | docType.setUpdateTime(new Date()); |
| | | storeTypeService.insert(docType); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/storeType/update/auth") |
| | | @ManagerAuth |
| | | public R update(StoreType docType) { |
| | | if (Cools.isEmpty(docType) || null == docType.getStoreId()) { |
| | | public R edit(@RequestParam(required = false) String param) { |
| | | if (Cools.isEmpty(param)) { |
| | | return R.error(); |
| | | } |
| | | docType.setUpdateBy(getUserId()); |
| | | docType.setUpdateTime(new Date()); |
| | | storeTypeService.updateById(docType); |
| | | StoreType storeType = storeTypeService.selectById(param); |
| | | storeType.setOwn(1); |
| | | storeTypeService.updateById(storeType); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/storeType/delete/auth") |
| | | @RequestMapping(value = "/store/edit2/auth") |
| | | @ManagerAuth |
| | | public R delete(@RequestParam(value = "ids[]") Long[] ids) { |
| | | for (Long id : ids) { |
| | | storeTypeService.deleteById(id); |
| | | public R edit2(@RequestParam(required = false) String param) { |
| | | if (Cools.isEmpty(param)) { |
| | | return R.error(); |
| | | } |
| | | StoreType storeType = storeTypeService.selectById(param); |
| | | storeType.setOwn(0); |
| | | storeTypeService.updateById(storeType); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/store/add/auth") |
| | | @ManagerAuth(memo = "入出库类型添加") |
| | | public R add(StoreType basWrkIotype) { |
| | | basWrkIotype.setUpdateBy(getUserId()); |
| | | basWrkIotype.setUpdateTime(new Date()); |
| | | basWrkIotype.setCreateBy(getUserId()); |
| | | basWrkIotype.setCreateTime(new Date()); |
| | | storeTypeService.insert(basWrkIotype); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/store/update/auth") |
| | | @ManagerAuth(memo = "入出库类型修改") |
| | | public R update(StoreType basWrkIotype) { |
| | | if (Cools.isEmpty(basWrkIotype) || null == basWrkIotype.getStoreId()) { |
| | | return R.error(); |
| | | } |
| | | basWrkIotype.setUpdateBy(getUserId()); |
| | | basWrkIotype.setUpdateTime(new Date()); |
| | | storeTypeService.updateById(basWrkIotype); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/store/delete/auth") |
| | | @ManagerAuth(memo = "入出库类型删除") |
| | | public R delete(@RequestParam String param) { |
| | | List<StoreType> list = JSONArray.parseArray(param, StoreType.class); |
| | | if (Cools.isEmpty(list)) { |
| | | return R.error(); |
| | | } |
| | | for (StoreType entity : list) { |
| | | storeTypeService.delete(new EntityWrapper<>(entity)); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/storeType/export/auth") |
| | | @ManagerAuth |
| | | @RequestMapping(value = "/store/export/auth") |
| | | @ManagerAuth(memo = "入出库类型导出") |
| | | public R export(@RequestBody JSONObject param) { |
| | | EntityWrapper<StoreType> wrapper = new EntityWrapper<>(); |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("docType")); |
| | | EntityWrapper<StoreType> wrapper = new EntityWrapper<>(); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("basWrkIotype")); |
| | | convert(map, wrapper); |
| | | List<StoreType> list = storeTypeService.selectList(wrapper); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/storeTypeQuery/auth") |
| | | @RequestMapping(value = "/store/auth") |
| | | @ManagerAuth |
| | | public R query(String condition) { |
| | | EntityWrapper<StoreType> wrapper = new EntityWrapper<>(); |
| | | wrapper.like("io_desc", condition); |
| | | Page<StoreType> page = storeTypeService.selectPage(new Page<>(0, 20), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (StoreType basWrkIotype : page.getRecords()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", basWrkIotype.getStoreId()); |
| | | map.put("value", basWrkIotype.getStoreName()); |
| | | result.add(map); |
| | | } |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @RequestMapping(value = "/store/check/column/auth") |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<StoreType> wrapper = new EntityWrapper<StoreType>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != storeTypeService.selectOne(wrapper)) { |
| | | return R.parse(BaseRes.REPEAT).add(getComment(BasWrkIotype.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/storeTypeQuery/auth") |
| | | @ManagerAuth |
| | | public R query3(String condition) { |
| | | EntityWrapper<StoreType> wrapper = new EntityWrapper<>(); |
| | | wrapper.like("store_name", condition); |
| | | wrapper.eq("status", 1); |
| | |
| | | } |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @RequestMapping(value = "/storeType/check/column/auth") |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<StoreType> wrapper = new EntityWrapper<StoreType>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != storeTypeService.selectOne(wrapper)) { |
| | | return R.parse(BaseRes.REPEAT).add(getComment(DocType.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | @RequestMapping("/available/put/site") |
| | | @ManagerAuth() |
| | | public R availablePutSite(){ |
| | | public R availablePutSite() { |
| | | return R.ok().add(basDevpService.getAvailableInSite()); |
| | | } |
| | | |
| | | @RequestMapping("/available/empty/put/site") |
| | | @ManagerAuth() |
| | | public R availableEmptyPutSite(){ |
| | | public R availableEmptyPutSite() { |
| | | return R.ok().add(basDevpService.getAvailableEmptyInSite()); |
| | | } |
| | | |
| | | @RequestMapping("/available/take/site") |
| | | @ManagerAuth() |
| | | public R availableTakeSite(){ |
| | | public R availableTakeSite() { |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | List<Integer> outSite = basDevpService.getAvailableOutSite(101); |
| | | for (Integer siteId : outSite) { |
| | |
| | | |
| | | @RequestMapping("/available/take/check/site") |
| | | @ManagerAuth() |
| | | public R availableTakeCheckSite(){ |
| | | public R availableTakeCheckSite() { |
| | | return R.ok().add(basDevpService.getAvailableOutSite(107)); |
| | | } |
| | | |
| | | @RequestMapping("/available/empty/take/site") |
| | | @ManagerAuth() |
| | | public R availableEmptyTakeSite(){ |
| | | public R availableEmptyTakeSite() { |
| | | return R.ok().add(basDevpService.getAvailableEmptyOutSite()); |
| | | } |
| | | |
| | |
| | | try { |
| | | String locNo = workService.startupFullPutStore(fullStoreParam, getUserId()); |
| | | return R.ok("入库启动成功").add(locNo); |
| | | } catch (Exception e){ |
| | | return R.error("入库启动失败==>"+e.getMessage()); |
| | | } catch (Exception e) { |
| | | return R.error("入库启动失败==>" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @RequestMapping("/plate/out/start") |
| | | @ManagerAuth(memo = "出库作业") |
| | | public R fullStoreTakeStart(@RequestBody StockOutParam param) { |
| | | workService.startupFullTakeStore(param, getUserId()); |
| | | return R.ok("出库启动成功"); |
| | | } |
| | | |
| | | @RequestMapping("/plate/out/start/v2") |
| | | @ManagerAuth(memo = "出库作业2") |
| | | public R fullStoreTakeStartV2(@RequestBody StockOutParam param) { |
| | | if (Cools.isEmpty(param.getItemId())) { |
| | | return R.error("转入仓库不能为空"); |
| | | } |
| | | workService.startupFullTakeStore(param, getUserId()); |
| | | return R.ok("出库启动成功"); |
| | | } |
| | |
| | | @RequestMapping("/mat/turn/over/out/start") |
| | | @ManagerAuth(memo = "品号移交") |
| | | public R turnMatLocDetl(@RequestBody EmptyPlateOutParam param) { |
| | | if (Cools.isEmpty(param) || Cools.isEmpty(param.getLocDetls(),param.getMatId()) || Cools.isEmpty(param.getLocDetls().get(0)) || Cools.isEmpty(param.getLocDetls().get(0).getMatnr())){ |
| | | if (Cools.isEmpty(param) || Cools.isEmpty(param.getLocDetls(), param.getMatId()) || Cools.isEmpty(param.getLocDetls().get(0)) || Cools.isEmpty(param.getLocDetls().get(0).getMatnr())) { |
| | | return R.error("参数为空"); |
| | | } |
| | | if (param.getLocDetls().size()>1){ |
| | | if (param.getLocDetls().size() > 1) { |
| | | return R.error("请单条数据修改,谨慎操作!"); |
| | | } |
| | | workService.turnMatLocDetl(param, getUserId()); |
| | |
| | | @RequestMapping("/hand/control/wrkMast") |
| | | @ManagerAuth(memo = "手动处理工作档") |
| | | public R handControlWrkMast(@RequestParam String workNo, |
| | | @RequestParam Integer type){ |
| | | @RequestParam Integer type) { |
| | | if (type == 1) { |
| | | workService.completeWrkMast(workNo, getUserId()); |
| | | return R.ok("工作档已完成"); |
| | |
| | | private Integer outSite; |
| | | |
| | | // |
| | | private String itemId; |
| | | |
| | | // |
| | | private String checkId; |
| | | |
| | | // 物料编号集合 |
| | |
| | | * @param locDetls 待出库物料 |
| | | * @param ioType 入出库类型 |
| | | */ |
| | | void stockOut(BasDevp staNo, List<LocDetlDto> locDetls, IoWorkType ioWorkType, Long userId,String checkOrderNo); |
| | | void stockOut(BasDevp staNo, List<LocDetlDto> locDetls, IoWorkType ioWorkType, Long userId,String checkOrderNo,String itemId); |
| | | |
| | | void stockOut(BasDevp staNo, TaskDto taskDto, Long userId); |
| | | |
| | |
| | | } |
| | | break; |
| | | case "采购到货": |
| | | process1 = processCGDH(orderDetls); |
| | | List<Object> cg = new ArrayList<>(); |
| | | cg.add(process1); |
| | | //发送请求 |
| | | response = SendUtil.sendDataToNc(SendUtil.token, nyncIp + ":" + port, purchasein, JSONObject.toJSONString(cg)); |
| | | if (!Cools.isEmpty(response) && response.isSuccess()) { |
| | | log.info("采购到货response:{}", response); |
| | | step = 10; |
| | | } else { |
| | | remark = response.getMessage() + "--" + response.getErrorStack().substring(0, 100); |
| | | } |
| | | //不需要上报了 |
| | | step = 10; |
| | | // process1 = processCGDH(orderDetls); |
| | | // List<Object> cg = new ArrayList<>(); |
| | | // cg.add(process1); |
| | | // //发送请求 |
| | | // response = SendUtil.sendDataToNc(SendUtil.token, nyncIp + ":" + port, purchasein, JSONObject.toJSONString(cg)); |
| | | // if (!Cools.isEmpty(response) && response.isSuccess()) { |
| | | // log.info("采购到货response:{}", response); |
| | | // step = 10; |
| | | // } else { |
| | | // remark = response.getMessage() + "--" + response.getErrorStack().substring(0, 100); |
| | | // } |
| | | break; |
| | | case "转库-出库": |
| | | if (step == 1) { |
| | |
| | | public void startupFullTakeStore(StockOutParam param, Long userId) { |
| | | // 目标站点状态检测 |
| | | BasDevp staNo = basDevpService.checkSiteStatus(param.getOutSite()); |
| | | if (Cools.isEmpty(param.getItemId())) { |
| | | throw new CoolException("所入仓库不能为空"); |
| | | } |
| | | // 获取库位明细 |
| | | List<LocDetlDto> locDetlDtos = new ArrayList<>(); |
| | | for (StockOutParam.LocDetl paramLocDetl : param.getLocDetls()) { |
| | |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetlDtos.get(0).getLocDetl().getLocNo())); |
| | | if (locMast.getLocSts().equals("F") || locMast.getLocSts().equals("D")) { |
| | | // 启动出库开始 101.出库 |
| | | stockOut(staNo, locDetlDtos, null, userId, null); |
| | | stockOut(staNo, locDetlDtos, null, userId, null, param.getItemId()); |
| | | } else { |
| | | throw new CoolException("所选库位存在状态不为F、D的库位,库位号:" + locMast.getLocNo() + " 、当前状态:" + locMast.getLocSts() + "-" + locMast.getLocSts$()); |
| | | } |
| | |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void stockOut(BasDevp staNo, List<LocDetlDto> locDetlDtos, IoWorkType ioWorkType, Long userId, String checkOrderNo) { |
| | | public void stockOut(BasDevp staNo, List<LocDetlDto> locDetlDtos, IoWorkType ioWorkType, Long userId, String checkOrderNo, String itemId) { |
| | | Date now = new Date(); |
| | | // 合并同类项 |
| | | Set<String> locNos = new HashSet<>(); |
| | |
| | | wrkMast.setAppeTime(now); |
| | | wrkMast.setModiUser(userId); |
| | | wrkMast.setModiTime(now); |
| | | wrkMast.setPacked(itemId); |
| | | if (!wrkMastService.insert(wrkMast)) { |
| | | throw new CoolException("保存工作档失败,出库库位号:" + dto.getLocNo()); |
| | | } |
| | |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetlDtos.get(0).getLocDetl().getLocNo())); |
| | | if (locMast.getLocSts().equals("F")) { |
| | | // 启动出库开始 107.盘点出库 |
| | | stockOut(staNo, locDetlDtos, IoWorkType.CHECK_OUT, userId, param.getCheckId()); |
| | | stockOut(staNo, locDetlDtos, IoWorkType.CHECK_OUT, userId, param.getCheckId(), null); |
| | | } else { |
| | | throw new CoolException("所选库位存在状态不为F的库位,库位号:" + locMast.getLocNo() + " 、当前状态:" + locMast.getLocSts() + "-" + locMast.getLocSts$()); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.SnowflakeIdWorker; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.task.AbstractHandler; |
| | |
| | | private OrderDetlPakoutService orderDetlPakoutService; |
| | | @Autowired |
| | | private OrderService orderService; |
| | | @Autowired |
| | | private StoreTypeService storeTypeService; |
| | | @Autowired |
| | | private SnowflakeIdWorker snowflakeIdWorker; |
| | | @Autowired |
| | | private DocTypeService docTypeService; |
| | | |
| | | |
| | | public ReturnT<String> start(WrkMast wrkMast) { |
| | | // 4.入库完成 |
| | |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg("拣料入库 ===>> 工作明细档为空; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getLocNo() + "]"); |
| | | } |
| | | |
| | | |
| | | |
| | | // 判断是否为转库出库 |
| | | StoreType storeType = null; |
| | | Order order = null; |
| | | if (!Cools.isEmpty(wrkMast.getPacked())) { |
| | | storeType = storeTypeService.selectById(wrkMast.getPacked()); |
| | | if (null != storeType) { |
| | | DocType docType = docTypeService.selectOne(new EntityWrapper<DocType>().eq("doc_name", "转库-出库")); |
| | | String convert = DateUtils.convert(now, DateUtils.yyyyMMdd); |
| | | order = new Order( |
| | | String.valueOf(snowflakeIdWorker.nextId()), // 编号[非空] |
| | | convert + "_" + wrkMast.getPacked() + "_" + wrkMast.getWrkNo(), // 订单编号 |
| | | DateUtils.convert(now), // 单据日期 |
| | | docType.getDocId(), // 单据类型 |
| | | storeType.getStoreId(), // 项目编号 |
| | | storeType.getStoreName(), // |
| | | null, // 调拨项目编号 |
| | | null, // 初始票据号 |
| | | null, // 票据号 |
| | | null, // 客户编号 |
| | | null, // 客户 |
| | | null, // 联系方式 |
| | | wrkMast.getAppeUser$(), // 操作人员 |
| | | null, // 合计金额 |
| | | null, // 优惠率 |
| | | null, // 优惠金额 |
| | | null, // 销售或采购费用合计 |
| | | null, // 实付金额 |
| | | null, // 付款类型 |
| | | null, // 业务员 |
| | | null, // 结算天数 |
| | | null, // 邮费支付类型 |
| | | null, // 邮费 |
| | | null, // 付款时间 |
| | | null, // 发货时间 |
| | | null, // 物流名称 |
| | | null, // 物流单号 |
| | | 1L, // 订单状态 |
| | | 4, // 状态 |
| | | wrkMast.getAppeUser(), // 添加人员 |
| | | now, // 添加时间 |
| | | wrkMast.getAppeUser(), // 修改人员 |
| | | now, // 修改时间 |
| | | null, // 备注 |
| | | docType.getPakin() == 1 ? 1 : 2 |
| | | ); |
| | | if (!orderService.insert(order)) { |
| | | throw new CoolException("保存订单主档失败"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | for (WrkDetl wrkDetl : wrkDetls53) { |
| | | |
| | | LocDetl locDetl = locDetlService.selectItem(locMast.getLocNo(), wrkDetl.getMatnr(), wrkDetl.getBatch(), wrkDetl.getBrand(), wrkDetl.getStandby1(), wrkDetl.getStandby2(), wrkDetl.getStandby3(), wrkDetl.getBoxType1(), wrkDetl.getBoxType2(), wrkDetl.getBoxType3()); |
| | |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg("全板出库 ===>> 工作明细档为空; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getSourceLocNo() + "]"); |
| | | } |
| | | for (WrkDetl wrkDetl : wrkDetls101) { |
| | | // 更新订单完成数量 |
| | | //addOrderDetlQty(wrkMast, wrkDetl); |
| | | OrderDetlPakout orderDetlPakout; |
| | | if (!Cools.isEmpty(wrkDetl.getThreeCode())) { |
| | | orderDetlPakout = orderDetlPakoutService.selectById(Long.parseLong(wrkDetl.getThreeCode())); |
| | | } else { |
| | | orderDetlPakout = orderDetlPakoutService.selectItem(wrkDetl.getOrderNo(), wrkDetl.getMatnr(), wrkDetl.getBatch(), wrkDetl.getBrand(), wrkDetl.getStandby1(), wrkDetl.getStandby2(), wrkDetl.getStandby3(), wrkDetl.getBoxType1(), wrkDetl.getBoxType2(), wrkDetl.getBoxType3()); |
| | | if (orderDetlPakout == null) { |
| | | orderDetlPakout = orderDetlPakoutService.selectItem(wrkDetl.getOrderNo(), wrkDetl.getMatnr(), null, wrkDetl.getBrand(), wrkDetl.getStandby1(), wrkDetl.getStandby2(), wrkDetl.getStandby3(), wrkDetl.getBoxType1(), wrkDetl.getBoxType2(), wrkDetl.getBoxType3()); |
| | | // 判断是否为转库出库 |
| | | StoreType storeType = null; |
| | | Order order = null; |
| | | if (!Cools.isEmpty(wrkMast.getPacked())) { |
| | | storeType = storeTypeService.selectById(wrkMast.getPacked()); |
| | | if (null != storeType) { |
| | | DocType docType = docTypeService.selectOne(new EntityWrapper<DocType>().eq("doc_name", "转库-出库")); |
| | | String convert = DateUtils.convert(now, DateUtils.yyyyMMdd); |
| | | order = new Order( |
| | | String.valueOf(snowflakeIdWorker.nextId()), // 编号[非空] |
| | | convert + "_" + wrkMast.getPacked() + "_" + wrkMast.getWrkNo(), // 订单编号 |
| | | DateUtils.convert(now), // 单据日期 |
| | | docType.getDocId(), // 单据类型 |
| | | storeType.getStoreId(), // 项目编号 |
| | | storeType.getStoreName(), // |
| | | null, // 调拨项目编号 |
| | | null, // 初始票据号 |
| | | null, // 票据号 |
| | | null, // 客户编号 |
| | | null, // 客户 |
| | | null, // 联系方式 |
| | | wrkMast.getAppeUser$(), // 操作人员 |
| | | null, // 合计金额 |
| | | null, // 优惠率 |
| | | null, // 优惠金额 |
| | | null, // 销售或采购费用合计 |
| | | null, // 实付金额 |
| | | null, // 付款类型 |
| | | null, // 业务员 |
| | | null, // 结算天数 |
| | | null, // 邮费支付类型 |
| | | null, // 邮费 |
| | | null, // 付款时间 |
| | | null, // 发货时间 |
| | | null, // 物流名称 |
| | | null, // 物流单号 |
| | | 1L, // 订单状态 |
| | | 4, // 状态 |
| | | wrkMast.getAppeUser(), // 添加人员 |
| | | now, // 添加时间 |
| | | wrkMast.getAppeUser(), // 修改人员 |
| | | now, // 修改时间 |
| | | null, // 备注 |
| | | docType.getPakin() == 1 ? 1 : 2 |
| | | ); |
| | | if (!orderService.insert(order)) { |
| | | throw new CoolException("保存订单主档失败"); |
| | | } |
| | | } |
| | | |
| | | try { |
| | | if (!Cools.isEmpty(orderDetlPakout)) { |
| | | if (!orderDetlPakoutService.increaseQtyById(orderDetlPakout.getId(), wrkDetl.getAnfme())) { |
| | | // exceptionHandle("全板出库 ===>> 更新订单完成数量失败;[workNo={0}],[locNo={1}]", |
| | | // wrkMast.getWrkNo(), wrkMast.getLocNo()); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg("全板出库 ===>> 更新订单完成数量失败; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getSourceLocNo() + "]"); |
| | | } |
| | | for (WrkDetl wrkDetl : wrkDetls101) { |
| | | if (storeType != null) { |
| | | OrderDetl orderDetl = new OrderDetl(); |
| | | orderDetl.sync(wrkDetl); |
| | | orderDetl.setOrderId(order.getId()); |
| | | orderDetl.setOrderNo(order.getOrderNo()); |
| | | orderDetl.setCreateBy(order.getCreateBy()); |
| | | orderDetl.setCreateTime(now); |
| | | orderDetl.setUpdateBy(order.getCreateBy()); |
| | | orderDetl.setUpdateTime(now); |
| | | orderDetl.setStatus(1); |
| | | orderDetl.setQty(wrkDetl.getAnfme()); |
| | | if (!orderDetlService.insert(orderDetl)) { |
| | | throw new CoolException("保存订单明细档失败"); |
| | | } |
| | | } else { |
| | | // 更新订单完成数量 |
| | | //addOrderDetlQty(wrkMast, wrkDetl); |
| | | OrderDetlPakout orderDetlPakout; |
| | | if (!Cools.isEmpty(wrkDetl.getThreeCode())) { |
| | | orderDetlPakout = orderDetlPakoutService.selectById(Long.parseLong(wrkDetl.getThreeCode())); |
| | | } else { |
| | | orderDetlPakout = orderDetlPakoutService.selectItem(wrkDetl.getOrderNo(), wrkDetl.getMatnr(), wrkDetl.getBatch(), wrkDetl.getBrand(), wrkDetl.getStandby1(), wrkDetl.getStandby2(), wrkDetl.getStandby3(), wrkDetl.getBoxType1(), wrkDetl.getBoxType2(), wrkDetl.getBoxType3()); |
| | | if (orderDetlPakout == null) { |
| | | orderDetlPakout = orderDetlPakoutService.selectItem(wrkDetl.getOrderNo(), wrkDetl.getMatnr(), null, wrkDetl.getBrand(), wrkDetl.getStandby1(), wrkDetl.getStandby2(), wrkDetl.getStandby3(), wrkDetl.getBoxType1(), wrkDetl.getBoxType2(), wrkDetl.getBoxType3()); |
| | | } |
| | | } |
| | | } catch (Exception ignore) { |
| | | |
| | | try { |
| | | if (!Cools.isEmpty(orderDetlPakout)) { |
| | | if (!orderDetlPakoutService.increaseQtyById(orderDetlPakout.getId(), wrkDetl.getAnfme())) { |
| | | // exceptionHandle("全板出库 ===>> 更新订单完成数量失败;[workNo={0}],[locNo={1}]", |
| | | // wrkMast.getWrkNo(), wrkMast.getLocNo()); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg("全板出库 ===>> 更新订单完成数量失败; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getSourceLocNo() + "]"); |
| | | } |
| | | } |
| | | } catch (Exception ignore) { |
| | | } |
| | | } |
| | | |
| | | } |
| | | // 删除工作档源库位的库存明细 |
| | | if (!locDetlService.delete(new EntityWrapper<LocDetl>().eq("loc_no", wrkMast.getSourceLocNo()))) { |
| | |
| | | layer.msg('请先提取商品库存', {icon: 2}); |
| | | } else { |
| | | var staNo = $("#staNoSelect").val(); |
| | | var itemId = $("#itemId").val(); |
| | | if (staNo === "" || staNo === null){ |
| | | layer.msg("请选择出库口", {icon: 2}); |
| | | return; |
New file |
| | |
| | | var locDetlLayerIdx; |
| | | var locDetlData = []; |
| | | function getCol() { |
| | | var cols = [ |
| | | {field: 'count', align: 'center',title: '出库数量', edit:'text', width: 130, style:'color: blue;font-weight: bold'} |
| | | ,{field: 'anfme', align: 'center',title: '库存数量'} |
| | | ,{field: 'locNo$', align: 'center',title: '库位号'} |
| | | ]; |
| | | arrRemove(detlCols, 'field', 'anfme'); |
| | | cols.push.apply(cols, detlCols); |
| | | cols.push({fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width: 80}) |
| | | return cols; |
| | | } |
| | | |
| | | layui.config({ |
| | | base: baseUrl + "/static/layui/lay/modules/" |
| | | }).use(['table','laydate', 'form', 'admin'], function() { |
| | | var table = layui.table; |
| | | var $ = layui.jquery; |
| | | var layer = layui.layer; |
| | | var form = layui.form; |
| | | var admin = layui.admin; |
| | | |
| | | tableIns = table.render({ |
| | | elem: '#chooseData', |
| | | headers: {token: localStorage.getItem('token')}, |
| | | data: [], |
| | | even: true, |
| | | toolbar: '#toolbar', |
| | | cellMinWidth: 50, |
| | | limit: 500, |
| | | cols: [getCol()], |
| | | done: function(res, curr, count) { |
| | | limit(); |
| | | getOutBound(); |
| | | } |
| | | }); |
| | | |
| | | // 页面修改 |
| | | table.on('edit(chooseData)', function (obj) { |
| | | let index = obj.tr.attr("data-index"); |
| | | let data = locDetlData[index]; |
| | | let modify = true; |
| | | if (obj.field === 'count'){ |
| | | let vle = Number(obj.value); |
| | | if (isNaN(vle)) { |
| | | layer.msg("请输入数字", {icon: 2}); |
| | | modify = false; |
| | | } else { |
| | | if (vle <= 0) { |
| | | layer.msg("数量必须大于零", {icon: 2}); |
| | | modify = false; |
| | | } |
| | | if (vle > Number(data.anfme)) { |
| | | layer.msg("出库数量不得大于库存数量", {icon: 2}); |
| | | modify = false; |
| | | } |
| | | } |
| | | } |
| | | if (modify) { |
| | | data[obj.field] = obj.value; |
| | | } |
| | | tableIns.reload({data: locDetlData}); |
| | | }); |
| | | |
| | | // 监听头工具栏事件 |
| | | table.on('toolbar(chooseData)', function (obj) { |
| | | switch (obj.event) { |
| | | case 'outbound': |
| | | if (locDetlData.length === 0){ |
| | | layer.msg('请先提取商品库存', {icon: 2}); |
| | | } else { |
| | | var staNo = $("#staNoSelect").val(); |
| | | var itemId = $("#itemId").val(); |
| | | if (staNo === "" || staNo === null){ |
| | | layer.msg("请选择出库口", {icon: 2}); |
| | | return; |
| | | } |
| | | if (itemId === "" || itemId === null){ |
| | | layer.msg("请选择入库仓库", {icon: 2}); |
| | | return; |
| | | } |
| | | let param = { |
| | | outSite: staNo, |
| | | itemId: itemId, |
| | | locDetls: locDetlData |
| | | } |
| | | $.ajax({ |
| | | url: baseUrl+"/plate/out/start/v2", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: JSON.stringify(param), |
| | | contentType:'application/json;charset=UTF-8', |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | locDetlData = []; |
| | | tableIns.reload({data: locDetlData,done:function (res) {limit();getOutBound();}}); |
| | | layer.msg(res.msg, {icon: 1}); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}) |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | break; |
| | | } |
| | | }); |
| | | |
| | | // 监听行工具事件 |
| | | table.on('tool(chooseData)', function(obj){ |
| | | switch (obj.event) { |
| | | case 'remove': |
| | | let index = obj.tr.attr("data-index"); |
| | | locDetlData.splice(index, 1); |
| | | tableIns.reload({data: locDetlData}); |
| | | break; |
| | | } |
| | | }); |
| | | |
| | | // 获取出库口 |
| | | function getOutBound(){ |
| | | $.ajax({ |
| | | url: baseUrl+"/available/take/site", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | method: 'POST', |
| | | async: false, |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | var tpl = $("#takeSiteSelectTemplate").html(); |
| | | var template = Handlebars.compile(tpl); |
| | | var html = template(res); |
| | | $('#staNoSelect').append(html); |
| | | form.render('select'); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | }else { |
| | | layer.msg(res.msg) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | |
| | | $(document).on('click','#mat-query', function () { |
| | | let loadIndex = layer.msg('请求中...', {icon: 16, shade: 0.01, time: false}); |
| | | locDetlLayerIdx = layer.open({ |
| | | type: 2, |
| | | title: false, |
| | | closeBtn: false, |
| | | maxmin: false, |
| | | area: ['90%', '85%'], |
| | | shadeClose: true, |
| | | content: 'locDetlQuery.html', |
| | | success: function(layero, index){ |
| | | layer.close(loadIndex); |
| | | } |
| | | }); |
| | | }) |
| | | |
| | | }) |
| | | |
| | | // 添加表格数据 |
| | | function addTableData(data) { |
| | | for (var i=0;i<data.length;i++){ |
| | | let pass = false; |
| | | for (var j=0;j<locDetlData.length;j++){ |
| | | if (data[i].matnr === locDetlData[j].matnr && data[i].batch === locDetlData[j].batch && data[i].locNo$ === locDetlData[j].locNo$) { |
| | | pass = true; |
| | | break; |
| | | } |
| | | } |
| | | if (pass) { |
| | | data.splice(i--, 1); |
| | | } else { |
| | | data[i]["count"] = data[i]["anfme"]; |
| | | } |
| | | } |
| | | locDetlData.push.apply(locDetlData, data); |
| | | tableIns.reload({data: locDetlData}); |
| | | layer.close(locDetlLayerIdx); |
| | | } |
| | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">出库仓库:</label> |
| | | <div class="layui-input-block cool-auto-complete"> |
| | | <input class="layui-input" name="defNumber" placeholder="请输入入库仓库" style="display: none"> |
| | | <input id="cstmr" name="cstmr" class="layui-input cool-auto-complete-div" onclick="autoShow(this.id)" type="text" placeholder="请输入单据类型" onfocus=this.blur() lay-verType="tips" lay-verify="required"> |
| | | <input class="layui-input" name="defNumber" placeholder="请输入出库仓库" style="display: none"> |
| | | <input id="cstmr" name="cstmr" 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="storeTypeQuery2BystoreType" onkeyup="autoLoad(this.getAttribute('data-key'))"> |
| | | <select class="cool-auto-complete-window-select" data-key="storeTypeQuery2BystoreTypeSelect" onchange="confirmed(this.getAttribute('data-key'))" multiple="multiple"> |
| | |
| | | <label class="layui-form-label">入库仓库:</label> |
| | | <div class="layui-input-block cool-auto-complete"> |
| | | <input class="layui-input" name="itemId" placeholder="请输入入库仓库" style="display: none"> |
| | | <input id="itemName" name="itemName" class="layui-input cool-auto-complete-div" onclick="autoShow(this.id)" type="text" placeholder="请输入单据类型" onfocus=this.blur() lay-verType="tips" lay-verify="required"> |
| | | <input id="itemName" name="itemName" 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="storeTypeQueryBystoreType" onkeyup="autoLoad(this.getAttribute('data-key'))"> |
| | | <select class="cool-auto-complete-window-select" data-key="storeTypeQueryBystoreTypeSelect" onchange="confirmed(this.getAttribute('data-key'))" multiple="multiple"> |
| | |
| | | width: 100px; |
| | | font-size: 13px; |
| | | } |
| | | |
| | | .layui-btn-container .layui-form-select { |
| | | display: inline-block; |
| | | width: 150px; |
| | |
| | | <!-- 头部 --> |
| | | <script type="text/html" id="toolbar"> |
| | | <div class="layui-form"> |
| | | <div class="layui-btn-container"> |
| | | <div class=" layui-inline layui-btn-container"> |
| | | <!-- 1.选择出库口 --> |
| | | <span id="staNoSpan">出库口:</span> |
| | | <select id="staNoSelect" lay-verify="required"> |
| | | <option value="">请选择站点</option> |
| | | </select> |
| | | <!-- 2.启动出库 --> |
| | | <button class="layui-btn layui-btn-lg" id="btn-outbound" lay-event="outbound">启动出库</button> |
| | | </div> |
| | | |
| | | |
| | | <!-- 2.启动出库 --> |
| | | <button class="layui-btn layui-btn-lg" id="btn-outbound" lay-event="outbound">启动出库</button> |
| | | </div> |
| | | </script> |
| | | |
New file |
| | |
| | | <!DOCTYPE html> |
| | | <html lang="en"> |
| | | <head> |
| | | <meta charset="utf-8"> |
| | | <title></title> |
| | | <meta name="renderer" content="webkit"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| | | <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
| | | <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all"> |
| | | <link rel="stylesheet" href="../../static/css/admin.css?v=318" media="all"> |
| | | <link rel="stylesheet" href="../../static/css/cool.css" media="all"> |
| | | <link rel="stylesheet" href="../../static/css/common.css" media="all"> |
| | | <style> |
| | | html { |
| | | height: 100%; |
| | | padding: 10px; |
| | | background-color: #f1f1f1; |
| | | box-sizing: border-box; |
| | | } |
| | | body { |
| | | background-color: #fff; |
| | | border-radius: 5px; |
| | | box-shadow: 0 0 3px rgba(0,0,0,.3); |
| | | padding-bottom: 20px; |
| | | } |
| | | |
| | | #staNoSpan { |
| | | text-align: center; |
| | | display: inline-block; |
| | | width: 100px; |
| | | font-size: 13px; |
| | | } |
| | | |
| | | .layui-btn-container .layui-form-select { |
| | | display: inline-block; |
| | | width: 150px; |
| | | height: 30px; |
| | | } |
| | | .layui-btn-container .layui-form-select.layui-form-selected { |
| | | display: inline-block; |
| | | width: 150px; |
| | | } |
| | | .layui-btn-container .layui-select-title input { |
| | | font-size: 13px; |
| | | } |
| | | .layui-btn-container .layui-anim.layui-anim-upbit dd { |
| | | font-size: 13px; |
| | | } |
| | | |
| | | #btn-outbound { |
| | | margin-left: 60px; |
| | | display: none; |
| | | } |
| | | |
| | | /*----------------------------------*/ |
| | | .function-area { |
| | | padding: 20px 50px; |
| | | } |
| | | .function-btn { |
| | | font-size: 16px; |
| | | padding: 1px 2px; |
| | | width: 100px; |
| | | height: 50px; |
| | | border-color: #2b425b; |
| | | border-radius: 4px; |
| | | border-width: 2px; |
| | | background: none; |
| | | border-style: solid; |
| | | transition: 0.4s; |
| | | cursor: pointer; |
| | | letter-spacing: 1.5px; |
| | | } |
| | | .function-btn:hover { |
| | | background-color: #2b425b; |
| | | color: #fff; |
| | | } |
| | | |
| | | #mat-query { |
| | | display: none; |
| | | } |
| | | </style> |
| | | </head> |
| | | <body> |
| | | |
| | | <!-- 功能区 --> |
| | | <div class="function-area"> |
| | | <button id="mat-query" class="function-btn">提取库存</button> |
| | | </div> |
| | | |
| | | <hr> |
| | | |
| | | <!-- 表格 --> |
| | | <div style="padding-bottom: 5px; margin-bottom: 45px"> |
| | | |
| | | <!-- 头部 --> |
| | | <script type="text/html" id="toolbar"> |
| | | <div class="layui-form"> |
| | | <div class=" layui-inline layui-btn-container"> |
| | | <!-- 1.选择出库口 --> |
| | | <span id="staNoSpan">出库口:</span> |
| | | <select id="staNoSelect" lay-verify="required"> |
| | | <option value="">请选择站点</option> |
| | | </select> |
| | | </div> |
| | | |
| | | <div class="layui-inline"> |
| | | <label style="width: 100px" class="layui-form-label">入库仓库:</label> |
| | | <div class="layui-input-block cool-auto-complete"> |
| | | <input class="layui-input" name="itemId" id="itemId" placeholder="请输入入库仓库" style="display: none"> |
| | | <input style="width: 200px" id="itemName" name="itemName" 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="storeTypeQueryBystoreType" onkeyup="autoLoad(this.getAttribute('data-key'))"> |
| | | <select class="cool-auto-complete-window-select" data-key="storeTypeQueryBystoreTypeSelect" onchange="confirmed(this.getAttribute('data-key'))" multiple="multiple"> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <!-- 2.启动出库 --> |
| | | <button class="layui-btn layui-btn-lg" id="btn-outbound" lay-event="outbound">启动出库</button> |
| | | </div> |
| | | </script> |
| | | |
| | | <!-- 行 --> |
| | | <script type="text/html" id="operate"> |
| | | <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="remove">移除</a> |
| | | </script> |
| | | |
| | | <table class="layui-table" id="chooseData" lay-filter="chooseData"></table> |
| | | </div> |
| | | |
| | | <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script> |
| | | <script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../static/js/handlebars/handlebars-v4.5.3.js"></script> |
| | | <script type="text/javascript" src="../../static/js/pakStore/stockOutZKCK.js" charset="utf-8"></script> |
| | | |
| | | <script type="text/template" id="takeSiteSelectTemplate"> |
| | | {{#each data}} |
| | | <option value="{{siteId}}">{{desc}}</option> |
| | | {{/each}} |
| | | </script> |
| | | </body> |
| | | </html> |
| | | |