New file |
| | |
| | | package zy.cloud.wms.common.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * Created by vincent on 2021/3/23 |
| | | */ |
| | | @Data |
| | | public class BillDto { |
| | | |
| | | private String matnr; |
| | | |
| | | private Double qty; |
| | | |
| | | } |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import zy.cloud.wms.common.model.BillDto; |
| | | import zy.cloud.wms.common.service.erp.entity.UploadBill; |
| | | import zy.cloud.wms.common.service.erp.entity.UploadBillDetail; |
| | | import zy.cloud.wms.manager.entity.Comb; |
| | | import zy.cloud.wms.manager.utils.HttpHandler; |
| | | |
| | | import java.util.ArrayList; |
| | |
| | | /** |
| | | * 单据上报 |
| | | */ |
| | | public Boolean uploadBill(List<Comb> combs, Integer docId, String docNumber){ |
| | | public Boolean uploadBill(List<BillDto> dtos, Integer docId, String docNumber){ |
| | | try { |
| | | if (Cools.isEmpty(combs)) { |
| | | if (Cools.isEmpty(dtos)) { |
| | | return false; |
| | | } |
| | | UploadBill uploadBill = new UploadBill(); |
| | |
| | | uploadBill.setVchType(docId); |
| | | List<UploadBillDetail> detail = new ArrayList<>(); |
| | | uploadBill.setDetail(detail); |
| | | for (Comb comb : combs) { |
| | | for (BillDto dto : dtos) { |
| | | UploadBillDetail detl = new UploadBillDetail(); |
| | | detl.setUserCode(comb.getMatnr()); |
| | | detl.setQty(comb.getAnfme()); |
| | | detl.setUserCode(dto.getMatnr()); |
| | | detl.setQty(dto.getQty()); |
| | | detl.setPrice(0.0D); |
| | | detail.add(detl); |
| | | } |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import zy.cloud.wms.common.model.BillDto; |
| | | import zy.cloud.wms.common.model.OrderStoDto; |
| | | import zy.cloud.wms.common.service.MainService; |
| | | import zy.cloud.wms.common.service.asrs.AsrsService; |
| | |
| | | } |
| | | |
| | | // 上报给erp |
| | | if (!erpService.uploadBill(combs, param.getDocType(), docNum)) { |
| | | List<BillDto> dtos = new ArrayList<>(); |
| | | for (Comb comb : combs) { |
| | | BillDto billDto = new BillDto(); |
| | | billDto.setMatnr(comb.getMatnr()); |
| | | billDto.setQty(comb.getAnfme()); |
| | | dtos.add(billDto); |
| | | } |
| | | if (!erpService.uploadBill(dtos, param.getDocType(), docNum)) { |
| | | throw new CoolException("无法上报至erp"); |
| | | } |
| | | |
| | |
| | | if (!custOrderService.updateStatus(param.getNumber(), 4)) { |
| | | throw new CoolException("修改单据状态失败"); |
| | | } |
| | | // 采购退货单 |
| | | if (param.getNumber().startsWith("PR-")) { |
| | | List<BillDto> dtos = new ArrayList<>(); |
| | | for (Pakout pakout : pakouts) { |
| | | BillDto billDto = new BillDto(); |
| | | billDto.setMatnr(pakout.getMatnr()); |
| | | billDto.setQty(pakout.getAnfme()); |
| | | dtos.add(billDto); |
| | | } |
| | | // erp单据上传 -- 采购退货单 |
| | | if (!erpService.uploadBill(dtos, 6, pakouts.get(0).getDocNum())) { |
| | | throw new CoolException("无法上报至erp"); |
| | | } |
| | | |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | cols: [[ |
| | | {type: 'checkbox'} |
| | | // ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80} |
| | | ,{field: 'number', align: 'center',title: '销售单号'} |
| | | ,{field: 'number', align: 'center',title: '单号'} |
| | | |
| | | ,{field: 'btypeId', align: 'center',title: '客户编号'} |
| | | ,{field: 'etypeId', align: 'center',title: '经手人编号', hide: true} |
| | |
| | | if (success) { |
| | | layer.open({ |
| | | type: 1, |
| | | title: '定义销售单编号', |
| | | title: '定义采购退货单编号', |
| | | offset: '100px', |
| | | area: ['360px'], |
| | | shade: 0.1, |
| | |
| | | |
| | | }); |
| | | }); |
| | | var number = data.field.orderNo; // 单号 |
| | | if (number.substring(0, 3) !== 'PR-') { |
| | | notice.error({ |
| | | title: '消息通知', |
| | | message: '单号不符合规则,请以 PR- 开头' |
| | | }); |
| | | return false; |
| | | } |
| | | var req = JSON.stringify({ |
| | | number: data.field.orderNo |
| | | number: number |
| | | , customerTypeId: data.field.customerTypeId |
| | | , list: matDetls |
| | | }) |
| | |
| | | </div> |
| | | <script type="text/html" id="toolbar"> |
| | | <div class="layui-btn-container"> |
| | | <button class="layui-btn" onclick="right()" style="background-color: #2F4056">新增销售单</button> |
| | | <button class="layui-btn" onclick="right()" style="background-color: #2F4056">新增采购退货单</button> |
| | | <!-- <button class="layui-btn layui-btn-sm" id="btn-add" lay-event="addData">新增</button>--> |
| | | <button class="layui-btn layui-btn-sm" id="btn-delete" lay-event="deleteData">删除</button> |
| | | <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData">导出</button> |