| | |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import com.zy.asrs.entity.param.StockOutParam; |
| | | import com.zy.asrs.service.OutStockService; |
| | | import com.zy.asrs.service.WorkService; |
| | | import com.zy.common.service.erp.entity.OutStockBillEntry; |
| | | import com.zy.common.web.BaseController; |
| | | 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 java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @RestController |
| | |
| | | |
| | | @Autowired |
| | | private OutStockService outStockService; |
| | | @Autowired |
| | | private WorkService workService; |
| | | |
| | | /** |
| | | * |
| | | * @param curr |
| | | * @param limit |
| | | * @param param |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/outStock/query/list") |
| | | @ManagerAuth |
| | | public R outStockQueryList(@RequestParam(defaultValue = "1")Integer curr, |
| | |
| | | @RequestParam Map<String, Object> param){ |
| | | return R.ok(outStockService.queryOutStock(toPage(curr, limit, param, OutStockBillEntry.class))); |
| | | } |
| | | |
| | | /** |
| | | * 检索符合通知单的库存物料 |
| | | * @param fbillNo |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/outStock/query/locList") |
| | | @ManagerAuth |
| | | public R queryMatWithLoc(String fbillNo) { |
| | | List<LocDetl> list = outStockService.queryMatWithLoc(fbillNo); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @RequestMapping(value = "/plate/outStock/start") |
| | | @ManagerAuth(memo = "出库作业") |
| | | public R fullStoreTakeStart(@RequestBody StockOutParam param) { |
| | | outStockService.startupFullTakeStore(param, getUserId()); |
| | | return R.ok("出库启动成功"); |
| | | } |
| | | } |
| | |
| | | */ |
| | | public class StockOutParam { |
| | | |
| | | // 单据编号 |
| | | private String fbillNo; |
| | | |
| | | // 出站口 |
| | | private Integer outSite; |
| | | |
| | |
| | | this.locDetls = locDetls; |
| | | } |
| | | |
| | | public String getFbillNo() { |
| | | return fbillNo; |
| | | } |
| | | |
| | | public void setFbillNo(String fbillNo) { |
| | | this.fbillNo = fbillNo; |
| | | } |
| | | |
| | | public static class LocDetl { |
| | | |
| | | // 库位号 |
| | |
| | | package com.zy.asrs.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import com.zy.common.service.erp.entity.OutStockBillEntry; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | |
| | | List<OutStockBillEntry> queryOutStock(Map<String, Object> map); |
| | | |
| | | Integer queryOutStockCount(Map<String, Object> map); |
| | | |
| | | List<LocDetl> queryMatWithLoc(String matnr); |
| | | |
| | | List<OutStockBillEntry> queryMatnrWithBillNo(String fbillNo); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import com.zy.asrs.entity.param.StockOutParam; |
| | | import com.zy.common.service.erp.entity.OutStockBillEntry; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | |
| | | public interface OutStockService extends IService<OutStockBillEntry> { |
| | | Page<OutStockBillEntry> queryOutStock(Page<OutStockBillEntry> page); |
| | | |
| | | List<LocDetl> queryMatWithLoc(String matnr); |
| | | |
| | | /** |
| | | * 出库作业 |
| | | */ |
| | | void startupFullTakeStore(StockOutParam param, Long userId); |
| | | } |
| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.StockOutParam; |
| | | import com.zy.asrs.mapper.OutStockMapper; |
| | | import com.zy.asrs.service.OutStockService; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.VersionUtils; |
| | | import com.zy.common.model.LocDetlDto; |
| | | import com.zy.common.model.OutLocDto; |
| | | import com.zy.common.service.CommonService; |
| | | import com.zy.common.service.erp.entity.OutStockBillEntry; |
| | | import io.swagger.models.auth.In; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | |
| | | @Service("outStockService") |
| | | public class OutStockServiceImpl extends ServiceImpl<OutStockMapper, OutStockBillEntry> implements OutStockService{ |
| | | // 工作号生成规则默认类型 |
| | | private static final int DEFAULT_WORK_NO_TYPE = 0; |
| | | @Autowired |
| | | private WrkMastService wrkMastService; |
| | | @Autowired |
| | | private BasDevpService basDevpService; |
| | | @Autowired |
| | | private LocDetlService locDetlService; |
| | | @Autowired |
| | | private LocMastService locMastService; |
| | | @Autowired |
| | | private StaDescService staDescService; |
| | | @Autowired |
| | | private CommonService commonService; |
| | | @Autowired |
| | | private WrkDetlService wrkDetlService; |
| | | |
| | | @Override |
| | | public Page<OutStockBillEntry> queryOutStock(Page<OutStockBillEntry> page) { |
| | | page.setRecords(baseMapper.queryOutStock(page.getCondition())); |
| | | page.setTotal(baseMapper.queryOutStockCount(page.getCondition())); |
| | | return page; |
| | | } |
| | | |
| | | @Override |
| | | public List<LocDetl> queryMatWithLoc(String fbillNo) { |
| | | List<OutStockBillEntry> matList = baseMapper.queryMatnrWithBillNo(fbillNo); |
| | | List<LocDetl> tempLocList = new ArrayList<LocDetl>(); |
| | | List<LocDetl> locList = new ArrayList<LocDetl>(); |
| | | for (Integer i = 0; i < matList.size(); i++) { |
| | | /*自动根据物料编码选取最优出货顺序(先进先出,靠外货物先出)*/ |
| | | tempLocList = baseMapper.queryMatWithLoc(matList.get(i).getFNumber()); |
| | | BigDecimal needNum = matList.get(i).getFAuxQty(); |
| | | BigDecimal locNum = BigDecimal.ZERO; |
| | | if (tempLocList.size() > 0) { |
| | | for (Integer j = 0; j < tempLocList.size(); j ++) { |
| | | locNum = locNum.add(new BigDecimal(tempLocList.get(j).getAnfme())); |
| | | /* 计算需要的数量,符合数量后结束循环 */ |
| | | if (needNum.compareTo(locNum) == 1) { |
| | | locList.add(tempLocList.get(j)); |
| | | } else { |
| | | locList.add(tempLocList.get(j)); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return locList; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void startupFullTakeStore(StockOutParam param, Long userId) { |
| | | // 目标站点状态检测 |
| | | BasDevp staNo = basDevpService.checkSiteStatus(param.getOutSite()); |
| | | // 获取库位明细 |
| | | List<LocDetlDto> locDetlDtos = new ArrayList<>(); |
| | | for (StockOutParam.LocDetl paramLocDetl : param.getLocDetls()) { |
| | | if (!Cools.isEmpty(paramLocDetl.getLocNo(), paramLocDetl.getMatnr(), paramLocDetl.getCount())) { |
| | | LocDetl sqlParam = new LocDetl(); |
| | | sqlParam.setLocNo(paramLocDetl.getLocNo()); |
| | | sqlParam.setMatnr(paramLocDetl.getMatnr()); |
| | | LocDetl one = locDetlService.selectOne(new EntityWrapper<>(sqlParam)); |
| | | if (null != one) locDetlDtos.add(new LocDetlDto(one, paramLocDetl.getCount())); |
| | | } |
| | | } |
| | | if (!locDetlDtos.isEmpty()) { |
| | | // 启动出库开始 101.出库 |
| | | stockOut(staNo, locDetlDtos, null, userId, param.getFbillNo()); |
| | | } else { |
| | | throw new CoolException("库位物料不存在"); |
| | | } |
| | | } |
| | | |
| | | // @Override |
| | | @Transactional |
| | | public void stockOut(BasDevp staNo, List<LocDetlDto> locDetlDtos, Integer ioType, Long userId, String fbillNo) { |
| | | // 合并同类项 |
| | | Set<String> locNos = new HashSet<>(); |
| | | locDetlDtos.forEach(dto -> locNos.add(dto.getLocDetl().getLocNo())); |
| | | List<OutLocDto> dtos = new ArrayList<>(); |
| | | for (String locNo : locNos) { |
| | | List<LocDetlDto> list = new ArrayList<>(); |
| | | Iterator<LocDetlDto> iterator = locDetlDtos.iterator(); |
| | | while (iterator.hasNext()) { |
| | | LocDetlDto dto = iterator.next(); |
| | | if (locNo.equals(dto.getLocDetl().getLocNo())) { |
| | | list.add(dto); |
| | | iterator.remove(); |
| | | } |
| | | } |
| | | dtos.add(new OutLocDto(locNo, list)); |
| | | } |
| | | // 生成工作档 |
| | | for (OutLocDto dto : dtos) { |
| | | // 判断入出库类型:101.全板出库 or 103.拣料出库 |
| | | if (ioType == null) { |
| | | ioType = dto.isAll() ? 101 : 103; |
| | | } |
| | | // 获取库位 |
| | | LocMast locMast = locMastService.selectById(dto.getLocNo()); |
| | | // 获取路径 |
| | | Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>() |
| | | .eq("type_no", ioType) |
| | | .eq("stn_no", staNo.getDevNo()) |
| | | .eq("crn_no", locMast.getCrnNo()); |
| | | StaDesc staDesc = staDescService.selectOne(wrapper); |
| | | if (Cools.isEmpty(staDesc)) { |
| | | throw new CoolException("出库路径不存在"); |
| | | } |
| | | // 生成工作号 |
| | | int workNo = commonService.getWorkNo(DEFAULT_WORK_NO_TYPE); |
| | | // 生成工作档 |
| | | WrkMast wrkMast = new WrkMast(); |
| | | wrkMast.setWrkNo(workNo); |
| | | wrkMast.setIoTime(new Date()); |
| | | wrkMast.setWrkSts(11L); // 工作状态:11.生成出库ID |
| | | wrkMast.setIoType(ioType); // 入出库状态 |
| | | wrkMast.setIoPri(13D); // 优先级:13 |
| | | wrkMast.setCrnNo(locMast.getCrnNo()); |
| | | wrkMast.setSourceStaNo(staDesc.getCrnStn()); // 源站 |
| | | wrkMast.setStaNo(staDesc.getStnNo()); // 目标站 |
| | | wrkMast.setSourceLocNo(dto.getLocNo()); // 源库位 |
| | | wrkMast.setFullPlt("Y"); // 满板:Y |
| | | wrkMast.setPicking("N"); // 拣料 |
| | | wrkMast.setExitMk("N"); // 退出 |
| | | wrkMast.setEmptyMk("N"); // 空板 |
| | | wrkMast.setLinkMis("N"); |
| | | wrkMast.setAppeUser(userId); // 操作人员数据 |
| | | wrkMast.setAppeTime(new Date()); |
| | | wrkMast.setModiUser(userId); |
| | | wrkMast.setModiTime(new Date()); |
| | | if (!wrkMastService.insert(wrkMast)) { |
| | | throw new CoolException("保存工作档失败,出库库位号:"+dto.getLocNo()); |
| | | } |
| | | // 生成工作档明细 |
| | | for (LocDetlDto detlDto : dto.getLocDetlDtos()) { |
| | | // 出库时,数量为0的直接忽略 |
| | | if (detlDto.getCount()==null || detlDto.getCount() <= 0.0D) {continue;} |
| | | WrkDetl wrkDetl = new WrkDetl(); |
| | | wrkDetl.setWrkNo(workNo); |
| | | wrkDetl.setIoTime(new Date()); |
| | | Double anfme = ioType==101?detlDto.getLocDetl().getAnfme():detlDto.getCount(); |
| | | wrkDetl.setAnfme(anfme); // 数量 |
| | | VersionUtils.setWrkDetl(wrkDetl, detlDto.getLocDetl()); // 版本控制 |
| | | wrkDetl.setAppeTime(new Date()); |
| | | wrkDetl.setAppeUser(userId); |
| | | wrkDetl.setModiTime(new Date()); |
| | | wrkDetl.setModiUser(userId); |
| | | wrkDetl.setWarehouse(fbillNo); |
| | | if (!wrkDetlService.insert(wrkDetl)) { |
| | | throw new CoolException("保存工作档明细失败"); |
| | | } |
| | | } |
| | | // 修改库位状态: F.在库 ====>>> R.出库预约/P.拣料/盘点/并板出库中 |
| | | locMast = locMastService.selectById(dto.getLocNo()); |
| | | if (locMast.getLocSts().equals("F")) { |
| | | locMast.setLocSts(ioType==101?"R":"P"); |
| | | locMast.setModiUser(userId); |
| | | locMast.setModiTime(new Date()); |
| | | if (!locMastService.updateById(locMast)) { |
| | | throw new CoolException("预约库位状态失败,库位号:"+dto.getLocNo()); |
| | | } |
| | | } else { |
| | | throw new CoolException(dto.getLocNo() + "库位不是在库状态"); |
| | | } |
| | | } |
| | | // todo:luxiaotao |
| | | // 同一列的同时出库,则优先出浅库位 |
| | | } |
| | | } |
| | |
| | | */ |
| | | @Data |
| | | public class OutStockBillEntry { |
| | | /* 订单状态,出库中或已出库 */ |
| | | private Integer workRecord; |
| | | /*单据编号-OutStockBill表数据 */ |
| | | private String FBillNo; |
| | | /*地址-OutStockBill表数据*/ |
| | |
| | | private Integer FSourceTranType; |
| | | |
| | | private Integer FSourceInterId; |
| | | |
| | | /*生产单号*/ |
| | | private String FSourceBillNo; |
| | | |
| | | private Integer FContractInterID; |
| | |
| | | private String Fmodel; |
| | | |
| | | private String Fname; |
| | | |
| | | private String Fnumber; |
| | | /*物料编码(产品代码)*/ |
| | | private String FNumber; |
| | | |
| | | private String FBarCode; |
| | | |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.zy.asrs.mapper.OutStockMapper"> |
| | | |
| | | <!-- 映射结果 --> |
| | | <!-- OutStockBillEntry映射结果 --> |
| | | <resultMap id="OutStockResultMap" type="com.zy.common.service.erp.entity.OutStockBillEntry"> |
| | | <result column="FBrNo" property="FBrNo"/> |
| | | <result column="FInterID" property="FInterID"/> |
| | |
| | | <result column="FAuxPrice" property="FAuxPrice"/> |
| | | <result column="FDate" property="FDate"/> |
| | | <result column="FNote" property="FNote"/> |
| | | <result column="Fnumber" property="FNumber"/> |
| | | <result column="FSourceBillNo" property="FSourceBillNo"/> |
| | | <result column="FBillNo" property="FBillNo"/> |
| | | <result column="FAdd" property="FAdd"/> |
| | | <result column="workRecord" property="workRecord"/> |
| | | </resultMap> |
| | | |
| | | <!-- asr_loc_detl映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.zy.asrs.entity.LocDetl"> |
| | | <result column="loc_no" property="locNo" /> |
| | | <result column="matnr" property="matnr" /> |
| | | <result column="maktx" property="maktx" /> |
| | | <result column="lgnum" property="lgnum" /> |
| | | <result column="type" property="type" /> |
| | | <result column="mnemonic" property="mnemonic" /> |
| | | <result column="supplier" property="supplier" /> |
| | | <result column="warehouse" property="warehouse" /> |
| | | <result column="brand" property="brand" /> |
| | | <result column="anfme" property="anfme" /> |
| | | <result column="altme" property="altme" /> |
| | | <result column="zpallet" property="zpallet" /> |
| | | <result column="bname" property="bname" /> |
| | | <result column="memo" property="memo" /> |
| | | <result column="modi_user" property="modiUser" /> |
| | | <result column="modi_time" property="modiTime" /> |
| | | <result column="appe_user" property="appeUser" /> |
| | | <result column="appe_time" property="appeTime" /> |
| | | <result column="mat_status" property="matStatus" /> |
| | | </resultMap> |
| | | |
| | | <sql id="stockOutCondition"> |
| | |
| | | select * from |
| | | ( |
| | | select ROW_NUMBER() over (order by a.FInterID,a.FEntryID) as row,a.FBrNo,a.FInterID,a.FEntryID, |
| | | a.FOrderInterID,a.FAuxQty,a.FCommitQty,a.FAuxPrice,a.FDate,a.FNote, b.FBillNo, b.FAdd |
| | | a.FOrderInterID,a.FAuxQty,a.FCommitQty,a.FAuxPrice,a.FDate,a.FNote, a.Fnumber, a.FSourceBillNo, b.FBillNo, |
| | | b.FAdd, |
| | | ((select COUNT(*) from asr_wrk_detl where warehouse = b.FBillNo and matnr = a.Fnumber) + (select COUNT(*) from asr_wrk_detl_log where warehouse = b.FBillNo and matnr = a.Fnumber)) as workRecord |
| | | from OutStockBillEntry a left join OutStockBill b on a.FInterID = b.FInterID |
| | | where 1=1 |
| | | <include refid="stockOutCondition"></include> |
| | | ) t where t.row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize}) |
| | | <if test="FBillNo!=null and FBillNo!='' "> |
| | | and b.FBillNo = #{FBillNo} |
| | | </if> |
| | | ) t where t.row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize}) and workRecord = 0 |
| | | </select> |
| | | |
| | | <select id="queryOutStockCount" parameterType="java.util.Map" resultType="java.lang.Integer"> |
| | |
| | | left join OutStockBill b on a.FInterID = b.FInterID |
| | | where 1=1 |
| | | </select> |
| | | |
| | | <select id="queryMatnrWithBillNo" resultMap="OutStockResultMap"> |
| | | select * from (select ROW_NUMBER() over (order by a.FInterID,a.FEntryID) as row,a.FBrNo,a.FInterID,a.FEntryID, |
| | | a.FOrderInterID,a.FAuxQty,a.FCommitQty,a.FAuxPrice,a.FDate,a.FNote, a.Fnumber, a.FSourceBillNo, b.FBillNo, |
| | | b.FAdd, |
| | | ((select COUNT(*) from asr_wrk_detl where warehouse = b.FBillNo and matnr = a.Fnumber) + (select COUNT(*) from asr_wrk_detl_log where warehouse = b.FBillNo and matnr = a.Fnumber)) as workRecord |
| | | from OutStockBillEntry a left join OutStockBill b on a.FInterID = b.FInterID |
| | | where b.FBillNo = #{FBillNo}) t where t.workRecord = 0 |
| | | </select> |
| | | |
| | | <select id="queryMatWithLoc" resultMap="BaseResultMap"> |
| | | select * from asr_loc_detl a left join asr_loc_mast b on a.loc_no = b.loc_no |
| | | where 1=1 |
| | | and b.loc_sts = 'F' |
| | | and a.matnr = #{matnr} |
| | | order by |
| | | DATEPART(yyyy,a.modi_time),DATEPART(mm,a.modi_time),DATEPART(dd,a.modi_time) |
| | | desc, |
| | | case |
| | | when (left(a.loc_no, 2) = '01') then 0 |
| | | when (left(a.loc_no, 2) = '02') then 1 |
| | | when (left(a.loc_no, 2) = '03') then 1 |
| | | when (left(a.loc_no, 2) = '04') then 0 |
| | | when (left(a.loc_no, 2) = '05') then 0 |
| | | when (left(a.loc_no, 2) = '06') then 1 |
| | | when (left(a.loc_no, 2) = '07') then 1 |
| | | when (left(a.loc_no, 2) = '08') then 0 |
| | | when (left(a.loc_no, 2) = '09') then 0 |
| | | when (left(a.loc_no, 2) = '10') then 1 |
| | | when (left(a.loc_no, 2) = '11') then 1 |
| | | when (left(a.loc_no, 2) = '12') then 0 |
| | | else 0 |
| | | end |
| | | desc |
| | | </select> |
| | | </mapper> |
| | |
| | | var pageCurr; |
| | | var tableMerge; |
| | | var orderData; |
| | | var outStockDetail; |
| | | |
| | | function getCol() { |
| | | var cols = []; |
| | | cols.push( |
| | | {field: 'fbillNo', merge: true, align: 'center', title: '单据编号'} |
| | | , {field: 'fadd', align: 'center', title: '地址'} |
| | | , {field: 'fnumber', align: 'center', title: '物料编号'} |
| | | , {field: 'fentryID', align: 'center', title: '分录号'} |
| | | , {field: 'forderInterID', align: 'center', title: '销售订单单号'} |
| | | , {field: 'fauxQty', align: 'center', title: '数量'} |
| | |
| | | , {field: 'fauxPrice', align: 'center', title: '单价'} |
| | | , {field: 'fdate', align: 'center', title: '日期'} |
| | | , {field: 'fnote', align: 'center', title: '备注'} |
| | | , {fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width: 80} |
| | | , {field: 'fadd', align: 'center', title: '地址'} |
| | | , {fixed: 'right', merge: ['fbillNo'], title: '操作', align: 'center', toolbar: '#operate', width: 80} |
| | | ); |
| | | return cols; |
| | | } |
| | |
| | | var layDate = layui.laydate; |
| | | var form = layui.form; |
| | | var upload = layui.upload; |
| | | tableMerge = layui.tableMerge |
| | | tableMerge = layui.tableMerge; |
| | | |
| | | // 数据渲染 |
| | | tableIns = table.render({ |
| | | elem: '#salesOrder', |
| | | headers: {token: localStorage.getItem('token')}, |
| | | url: baseUrl+'/outStock/query/list', |
| | | url: baseUrl + '/outStock/query/list', |
| | | page: true, |
| | | limit: 16, |
| | | limits: [16, 50, 100, 200, 500], |
| | |
| | | response: { |
| | | statusCode: 200 |
| | | }, |
| | | done: function(res, curr, count) { |
| | | done: function (res, curr, count) { |
| | | if (res.code === 403) { |
| | | top.location.href = baseUrl+"/"; |
| | | top.location.href = baseUrl + "/"; |
| | | } |
| | | pageCurr=curr; |
| | | tableMerge.render(this) |
| | | pageCurr = curr; |
| | | layui.tableMerge.render(this); |
| | | } |
| | | }); |
| | | |
| | |
| | | , type: 'datetime' |
| | | , range: true |
| | | }); |
| | | |
| | | table.on('tool(salesOrder)', function (obj) { |
| | | var data = obj.data; //获得当前行数据 |
| | | var layEvent = obj.event; //获得 lay-event 对应的值(也可以是表头的 event 参数对应的值) |
| | | orderData = data; |
| | | // 如果是点击操作按钮 |
| | | if (layEvent == 'btnOut') { |
| | | outStockDetail = layer.open( |
| | | { |
| | | type: 2, |
| | | title: '选择出库-单据编号[' + orderData.fbillNo + ']', |
| | | maxmin: true, |
| | | area: [top.detailWidth, top.detailHeight], |
| | | shadeClose: false, |
| | | content: 'outStockDetail.html', |
| | | success: function (layero, index) { |
| | | |
| | | } |
| | | } |
| | | ); |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | function getOrderData() { |
| | | return orderData; |
| | | } |
| | | |
| | | /* 表格数据重载 */ |
| | | function tableReload(child) { |
| | |
| | | top.location.href = baseUrl + "/"; |
| | | } |
| | | pageCurr = curr; |
| | | if (res.data.length === 0 && count !== 0) { |
| | | tableIns.reload({ |
| | | where: searchData, |
| | | page: { |
| | | curr: pageCurr - 1 |
| | | } |
| | | }); |
| | | pageCurr -= 1; |
| | | } |
| | | limit(child); |
| | | tableMerge.render(this); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /* 关闭明细 */ |
| | | function closeDetail(msg) { |
| | | layer.close(outStockDetail); |
| | | layer.msg(msg); |
| | | } |
| | | |
| | | /* 监听回车事件 */ |
| | | $('body').keydown(function () { |
| | | if (event.keyCode === 13) { |
| | |
| | | <div id="search-box" class="layui-form layui-card-header"> |
| | | <div class="layui-inline"> |
| | | <div class="layui-input-inline"> |
| | | <input class="layui-input" type="text" name="condition" placeholder="请输入单据编号" autocomplete="off"> |
| | | <input class="layui-input" type="text" name="FBillNo" placeholder="请输入单据编号" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | |
| | | <!--<!– 日期范围 –>--> |
| | | <!--<div class="layui-inline" style="width: 300px">--> |
| | | <!--<div class="layui-input-inline">--> |
| | | <!--<input class="layui-input layui-laydate-range" name="orderTime" type="text" placeholder="起始时间 - 终止时间" autocomplete="off" style="width: 300px">--> |
| | | <!--</div>--> |
| | | <!--<div class="layui-input-inline">--> |
| | | <!--<input class="layui-input layui-laydate-range" name="orderTime" type="text" placeholder="起始时间 - 终止时间" autocomplete="off" style="width: 300px">--> |
| | | <!--</div>--> |
| | | <!--</div>--> |
| | | |
| | | |
| | |
| | | </div> |
| | | |
| | | <script type="text/html" id="operate"> |
| | | <button class="layui-btn layui-btn-danger layui-btn-xs" lay-event="btnPrint">操作</button> |
| | | <button class="layui-btn layui-btn-danger layui-btn-xs" lay-event="btnOut">出库</button> |
| | | </script> |
| | | |
| | | <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></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/cool.css" media="all"> |
| | | <link rel="stylesheet" href="../../static/css/common.css" media="all"> |
| | | <link rel="stylesheet" href="../../static/css/print.css" media="all"> |
| | | |
| | | </head> |
| | | <body> |
| | | <div> |
| | | <div class="layui-form" style="padding: 8px"> |
| | | <span id="staNoSpan">出库口:</span> |
| | | <div style="display: inline-block; width: 200px"> |
| | | <select id="staNoSelect" lay-verify="required"> |
| | | <option value="">请选择站点</option> |
| | | </select> |
| | | </div> |
| | | <button class="layui-btn layui-btn-sm" style="display: inline-block" id="btn-outbound" lay-event="outbound" |
| | | onclick="outbound()">启动出库 |
| | | </button> |
| | | </div> |
| | | <table class="layui-hide" id="stockOut" lay-filter="stockOut"></table> |
| | | </div> |
| | | |
| | | <script type="text/template" id="takeSiteSelectTemplate"> |
| | | {{#each data}} |
| | | <option value="{{siteId}}">{{desc}}</option> |
| | | {{/each}} |
| | | </script> |
| | | |
| | | </body> |
| | | <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/handlebars/handlebars-v4.5.3.js"></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> |
| | | var orderData = parent.getOrderData(); |
| | | var locData = []; |
| | | var form; |
| | | |
| | | |
| | | function getCol() { |
| | | var cols = [ |
| | | {field: '', align: 'center', title: '', width: 50, type: 'numbers'} |
| | | , {field: 'locNo$', align: 'center', title: '库位号'} |
| | | ]; |
| | | cols.push.apply(cols, detlCols); |
| | | cols.push({field: 'modiUser$', align: 'center', title: '修改人员', hide: true} |
| | | , {field: 'modiTime$', align: 'center', title: '修改时间', hide: true}) |
| | | return cols; |
| | | } |
| | | |
| | | layui.use(['table', 'laydate', 'form'], function () { |
| | | var table = layui.table; |
| | | var $ = layui.jquery; |
| | | var layer = layui.layer; |
| | | var layDate = layui.laydate; |
| | | form = layui.form; |
| | | // 数据渲染 |
| | | locDetlTableIns = table.render({ |
| | | elem: '#stockOut', |
| | | headers: {token: localStorage.getItem('token')}, |
| | | url: baseUrl + '/outStock/query/locList?fbillNo=' + orderData.fbillNo, |
| | | page: true, |
| | | limit: 9999, |
| | | limits: [9999], |
| | | even: true, |
| | | // cellMinWidth: 50, |
| | | cols: [getCol()], |
| | | request: { |
| | | pageName: 'curr', |
| | | pageSize: 'limit' |
| | | }, |
| | | parseData: function (res) { |
| | | return { |
| | | 'data': res.data, |
| | | 'code': res.code, |
| | | } |
| | | }, |
| | | response: { |
| | | statusCode: 200 |
| | | }, |
| | | done: function (res, curr, count) { |
| | | if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } |
| | | locData = res.data; |
| | | } |
| | | }); |
| | | |
| | | $.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) |
| | | } |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | /* 启动出库 */ |
| | | function outbound() { |
| | | if (locData.length == 0) { |
| | | layer.msg('请先添加库位物料'); |
| | | return; |
| | | } else { |
| | | var staNo = $("#staNoSelect").val(); |
| | | if (staNo === "" || staNo === null){ |
| | | layer.msg("请选择出库口"); |
| | | return; |
| | | } |
| | | var locDetls = []; |
| | | locData.forEach(function(elem) { |
| | | locDetls.push({locNo: elem.locNo, matnr: elem.matnr, count: elem.anfme}); |
| | | }); |
| | | let param = { |
| | | outSite: staNo, |
| | | locDetls: locDetls, |
| | | fbillNo: orderData.fbillNo, |
| | | } |
| | | |
| | | $.ajax({ |
| | | url: baseUrl+"/plate/outStock/start", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: JSON.stringify(param), |
| | | contentType:'application/json;charset=UTF-8', |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | parent.closeDetail(res.msg); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | | layer.msg(res.msg) |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | </script> |
| | | </html> |