| | |
| | | String USER_10002 = "10002-账号已被禁用"; |
| | | String USER_10003 = "10003-密码错误"; |
| | | |
| | | // stock |
| | | String NONE_STOCK = "20002-库存不足"; |
| | | |
| | | } |
New file |
| | |
| | | package zy.cloud.wms.common.config; |
| | | |
| | | /** |
| | | * Created by vincent on 2021/3/2 |
| | | */ |
| | | public class CodeCoolException extends RuntimeException { |
| | | |
| | | public CodeCoolException(Throwable e) { |
| | | super(e); |
| | | } |
| | | |
| | | public CodeCoolException(String message) { |
| | | super(message); |
| | | } |
| | | |
| | | } |
| | |
| | | return R.error(e.getMessage()); |
| | | } |
| | | |
| | | @ExceptionHandler(CodeCoolException.class) |
| | | public R handleRRException(CodeCoolException e) { |
| | | return R.parse(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.core.common.Cools; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | import zy.cloud.wms.common.model.OrderStoDto; |
| | | import zy.cloud.wms.manager.entity.CustOrder; |
| | |
| | | /** |
| | | * 扫描销售订单数据,生成出库单 |
| | | */ |
| | | @Scheduled(cron = "0/5 * * * * ? ") |
| | | // @Scheduled(cron = "0/5 * * * * ? ") |
| | | public void stockOutExecute(){ |
| | | List<CustOrder> custOrders = custOrderService.selectList(new EntityWrapper<CustOrder>().eq("status", 1)); |
| | | if (Cools.isEmpty(custOrders)){ |
| | |
| | | for (Prior prior : priors) { |
| | | LocDetl locDetl = locDetlService.getLocDetl(prior.getNodeId(), prior.getMatnr()); |
| | | if (null != locDetl && locDetl.getAnfme() > 0) { |
| | | // 保存出库通知单 |
| | | // 保存出库通知单\ |
| | | Pakout pakout = new Pakout(); |
| | | pakout.setWrkSts(1L); |
| | | // pakout.setAnfme(); |
| | |
| | | |
| | | } |
| | | } |
| | | } else { |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import zy.cloud.wms.common.web.BaseController; |
| | | import zy.cloud.wms.manager.entity.param.StockInParam; |
| | |
| | | return workService.stockIn(stockInParam, getUserId()); |
| | | } |
| | | |
| | | @RequestMapping("/stock/out/check") |
| | | @ManagerAuth(memo = "拣货") |
| | | public R stockOutCheck(@RequestParam String number) { |
| | | return workService.stockOutCheck(number, getUserId()); |
| | | } |
| | | |
| | | @RequestMapping("/stock/out") |
| | | @ManagerAuth(memo = "拣货") |
| | | public R stockOut(@RequestBody StockOutParam stockOutParam) { |
| | |
| | | List<LocDetl> listByPage(Page page, @Param("nodeId") String nodeId, @Param("locNo") Object locNo, @Param("matnr") Object matnr, @Param("maktx") Object maktx); |
| | | |
| | | LocDetl selectByLocNoAndMatnr(@Param("nodeId")Long nodeId, @Param("matnr")String martnr); |
| | | |
| | | Double selectCountByMatnr(@Param("matnr") String matnr); |
| | | |
| | | } |
| | |
| | | |
| | | LocDetl getLocDetl(Long nodeId, String matnr); |
| | | |
| | | void checkLocDetlCount(String number); |
| | | |
| | | } |
| | |
| | | |
| | | R stockIn(StockInParam param, Long userId); |
| | | |
| | | R stockOutCheck(String number, Long userId); |
| | | |
| | | R stockOut(StockOutParam param, Long userId); |
| | | |
| | | } |
| | |
| | | package zy.cloud.wms.manager.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import zy.cloud.wms.common.config.CodeCoolException; |
| | | import zy.cloud.wms.manager.entity.CustOrder; |
| | | import zy.cloud.wms.manager.entity.LocDetl; |
| | | import zy.cloud.wms.manager.entity.Mat; |
| | | import zy.cloud.wms.manager.mapper.LocDetlMapper; |
| | | import zy.cloud.wms.manager.service.CustOrderService; |
| | | import zy.cloud.wms.manager.service.LocDetlService; |
| | | import zy.cloud.wms.manager.service.MatService; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service("locDetlService") |
| | | public class LocDetlServiceImpl extends ServiceImpl<LocDetlMapper, LocDetl> implements LocDetlService { |
| | | |
| | | @Autowired |
| | | private CustOrderService custOrderService; |
| | | @Autowired |
| | | private MatService matService; |
| | | |
| | | @Override |
| | | public Page<LocDetl> getPage(Page page, String nodeId, Object locNo, Object matnr, Object maktx) { |
| | |
| | | return this.baseMapper.selectByLocNoAndMatnr(nodeId, matnr); |
| | | } |
| | | |
| | | @Override |
| | | public void checkLocDetlCount(String number) { |
| | | List<CustOrder> custOrders = custOrderService.selectList(new EntityWrapper<CustOrder>().eq("number", number).eq("status", 1)); |
| | | StringBuilder errorMsg = new StringBuilder(); |
| | | boolean error = false; |
| | | for (CustOrder custOrder : custOrders) { |
| | | Double count = this.baseMapper.selectCountByMatnr(custOrder.getUserCode()); |
| | | if (count == null) { |
| | | count = 0.0D; |
| | | } |
| | | if (count < custOrder.getQty()) { |
| | | if (!error) { |
| | | error = true; |
| | | } |
| | | Mat mat = matService.selectByMatnr(custOrder.getUserCode()); |
| | | errorMsg.append(mat == null ? custOrder.getUserCode() : mat.getMaktx()).append("库存不足,缺货数量:").append(custOrder.getQty() - count).append("</br>"); |
| | | } |
| | | } |
| | | if (error) { |
| | | throw new CodeCoolException("20001-" + errorMsg.toString()); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R stockOutCheck(String number, Long userId) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R stockOut(StockOutParam param, Long userId) { |
| | | // 检查库存是否足够 |
| | | locDetlService.checkLocDetlCount(param.getNumber()); |
| | | |
| | | return null; |
| | | } |
| | | |
| | |
| | | select * from man_loc_detl where 1=1 and node_id = #{nodeId} and matnr = #{matnr} |
| | | </select> |
| | | |
| | | <select id="selectCountByMatnr" resultType="java.lang.Double"> |
| | | select sum(anfme) as count from man_loc_detl where 1=1 and matnr = #{matnr} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | case 'stockOut': |
| | | layer.confirm(data.number + ' 订单拣货', {shadeClose: true}, function(){ |
| | | layer.closeAll(); |
| | | $.ajax({ |
| | | url: baseUrl+"/work/stock/out", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | contentType:'application/json;charset=UTF-8', |
| | | data: JSON.stringify({ |
| | | number: data.number |
| | | }), |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | |
| | | } else if (res.code === 20001) { |
| | | layer.confirm(res.msg, {shadeClose: true}, function(){ |
| | | layer.closeAll(); |
| | | }) |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | | layer.msg(res.msg) |
| | | } |
| | | layer.close(index); |
| | | } |
| | | }) |
| | | }); |
| | | // layer.open({ |
| | | // type: 2, |
| | | // title: data.number + ' 订单拣货', |
| | | // maxmin: true, |
| | | // area: [top.detailWidth, top.detailHeight], |
| | | // shadeClose: true, |
| | | // content: 'custOrder_detail.html', |
| | | // success: function(layero, index){ |
| | | // setFormVal(layer.getChildFrame('#detail', index), data, true); |
| | | // top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true); |
| | | // layer.getChildFrame('#data-detail-submit-save,#data-detail-submit-edit,#prompt', index).hide(); |
| | | // layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"}); |
| | | // layero.find('iframe')[0].contentWindow.layui.form.render('select'); |
| | | // layero.find('iframe')[0].contentWindow.layui.form.render('checkbox'); |
| | | // } |
| | | // }); |
| | | break; |
| | | // 详情 |
| | | case 'detail': |