add:采购单据打印
opt:采购单转发中鼎优化
This commit is contained in:
@@ -0,0 +1,15 @@
|
|||||||
|
package org.nl.config;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Configuration
|
||||||
|
@ConfigurationProperties("printer")
|
||||||
|
public class PrinterProperties {
|
||||||
|
|
||||||
|
private String ip = "192.168.1.100";
|
||||||
|
|
||||||
|
private int port = 9100;
|
||||||
|
}
|
||||||
@@ -64,16 +64,17 @@ public class InboundEasSyncServiceImpl implements InboundEasSyncService {
|
|||||||
|
|
||||||
easMst.setBill_status(PurchaseBillStatus.CREATED.getCode());
|
easMst.setBill_status(PurchaseBillStatus.CREATED.getCode());
|
||||||
easMst.setModify_date(DateUtil.now());
|
easMst.setModify_date(DateUtil.now());
|
||||||
purchasemstMapper.insert(easMst);
|
|
||||||
|
|
||||||
for (Purchasedtl dtl : easDtlList) {
|
for (Purchasedtl dtl : easDtlList) {
|
||||||
purchasedtlMapper.insert(dtl);
|
purchasedtlMapper.insert(dtl);
|
||||||
if (dtl.getHouse_code().contains("ZDLK")){
|
if (dtl.getHouse_code().contains("ZDLK")){
|
||||||
//中鼎立库
|
//中鼎立库
|
||||||
|
easMst.setForwardZD(1);
|
||||||
//TODO 转发中鼎参数待确定
|
//TODO 转发中鼎参数待确定
|
||||||
wmsToZDWmdService.syncPurchaseReceiving(new JSONObject());
|
wmsToZDWmdService.syncPurchaseReceiving(new JSONObject());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
purchasemstMapper.insert(easMst);
|
||||||
|
|
||||||
log.info("EAS采购入库单同步完成, billId: {}, 明细数: {}", billId, easDtlList.size());
|
log.info("EAS采购入库单同步完成, billId: {}, 明细数: {}", billId, easDtlList.size());
|
||||||
JSONObject result = new JSONObject();
|
JSONObject result = new JSONObject();
|
||||||
|
|||||||
@@ -63,4 +63,11 @@ public class PurchaseController {
|
|||||||
purchaseService.issueReturnBill(ids);
|
purchaseService.issueReturnBill(ids);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/print")
|
||||||
|
@Log("打印采购入库单")
|
||||||
|
public ResponseEntity<Object> print(@RequestBody Set<String> ids) {
|
||||||
|
purchaseService.print(ids);
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,5 +32,7 @@ public interface PurchaseService extends IService<Purchasemst> {
|
|||||||
|
|
||||||
List<Purchasedtl> selectListByBillId(String billId);
|
List<Purchasedtl> selectListByBillId(String billId);
|
||||||
|
|
||||||
|
void print(Set<String> ids);
|
||||||
|
|
||||||
List<PurchaseMatInfoVo> selectPdaInMat(HashMap of);
|
List<PurchaseMatInfoVo> selectPdaInMat(HashMap of);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ public class Purchasemst implements Serializable {
|
|||||||
|
|
||||||
private String order_type;
|
private String order_type;
|
||||||
|
|
||||||
|
private Integer forwardZD;
|
||||||
|
|
||||||
private String supplier_code;
|
private String supplier_code;
|
||||||
|
|
||||||
private String supplier_name;
|
private String supplier_name;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
m.bill_id,
|
m.bill_id,
|
||||||
m.order_no,
|
m.order_no,
|
||||||
m.order_type,
|
m.order_type,
|
||||||
|
m.forwardZD,
|
||||||
m.supplier_code,
|
m.supplier_code,
|
||||||
m.supplier_name,
|
m.supplier_name,
|
||||||
m.creator,
|
m.creator,
|
||||||
|
|||||||
@@ -28,10 +28,15 @@ import org.nl.wms.warehouse_manage.enums.IOSEnum;
|
|||||||
import org.nl.wms.warehouse_manage.stockReturn.service.IPmStockReturnService;
|
import org.nl.wms.warehouse_manage.stockReturn.service.IPmStockReturnService;
|
||||||
import org.nl.wms.warehouse_manage.stockReturn.service.dao.PmStockReturn;
|
import org.nl.wms.warehouse_manage.stockReturn.service.dao.PmStockReturn;
|
||||||
import org.nl.wms.warehouse_manage.stockReturn.service.enums.StockReturnStatusEnum;
|
import org.nl.wms.warehouse_manage.stockReturn.service.enums.StockReturnStatusEnum;
|
||||||
|
import org.nl.config.PrinterProperties;
|
||||||
|
import org.nl.wms.pm_manage.purchase.util.ZplUtil;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.net.Socket;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -50,6 +55,9 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchasemstMapper, Purchase
|
|||||||
@Autowired
|
@Autowired
|
||||||
private WmsToErpService wmsToErpService;
|
private WmsToErpService wmsToErpService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PrinterProperties printerProperties;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<PurchasemstListVo> queryAll(Map whereJson, PageQuery page) {
|
public IPage<PurchasemstListVo> queryAll(Map whereJson, PageQuery page) {
|
||||||
return purchasemstMapper.queryAllByPage(
|
return purchasemstMapper.queryAllByPage(
|
||||||
@@ -192,6 +200,38 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchasemstMapper, Purchase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void print(Set<String> ids) {
|
||||||
|
List<Purchasemst> mstList = purchasemstMapper.selectBatchIds(ids);
|
||||||
|
if (ObjectUtil.isEmpty(mstList)) {
|
||||||
|
throw new BadRequestException("未找到选中的单据");
|
||||||
|
}
|
||||||
|
StringBuilder allZpl = new StringBuilder();
|
||||||
|
int labelCount = 0;
|
||||||
|
for (Purchasemst mst : mstList) {
|
||||||
|
List<Purchasedtl> dtlList = purchasedtlMapper.selectList(
|
||||||
|
new LambdaQueryWrapper<Purchasedtl>()
|
||||||
|
.eq(Purchasedtl::getBill_id, mst.getBill_id()));
|
||||||
|
for (Purchasedtl dtl : dtlList) {
|
||||||
|
String zpl = ZplUtil.generateLabel(
|
||||||
|
dtl.getSku_name(), dtl.getSku_code(),
|
||||||
|
dtl.getQty() != null ? dtl.getQty().stripTrailingZeros().toPlainString() : "0",
|
||||||
|
dtl.getUnit(), mst.getBill_id(), dtl.getItem_no());
|
||||||
|
allZpl.append(zpl);
|
||||||
|
labelCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try (Socket socket = new Socket(printerProperties.getIp(), printerProperties.getPort());
|
||||||
|
OutputStream out = socket.getOutputStream()) {
|
||||||
|
out.write(allZpl.toString().getBytes(StandardCharsets.UTF_8));
|
||||||
|
out.flush();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("打印失败, 打印机: {}:{}, 标签数: {}", printerProperties.getIp(), printerProperties.getPort(), labelCount, e);
|
||||||
|
throw new BadRequestException("打印机连接失败: " + e.getMessage());
|
||||||
|
}
|
||||||
|
log.info("打印成功, 打印机: {}:{}, 标签数: {}", printerProperties.getIp(), printerProperties.getPort(), labelCount);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PurchaseMatInfoVo> pdaInboundSelectMatInfo(Map whereJson) {
|
public List<PurchaseMatInfoVo> pdaInboundSelectMatInfo(Map whereJson) {
|
||||||
return purchasemstMapper.selectPdaInMat(whereJson);
|
return purchasemstMapper.selectPdaInMat(whereJson);
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ public class PurchasemstListVo {
|
|||||||
|
|
||||||
private String order_type;
|
private String order_type;
|
||||||
|
|
||||||
|
private Integer forwardZD;
|
||||||
|
|
||||||
private String supplier_code;
|
private String supplier_code;
|
||||||
|
|
||||||
private String supplier_name;
|
private String supplier_name;
|
||||||
|
|||||||
@@ -27,7 +27,8 @@
|
|||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
<crudOperation :permission="permission">
|
<crudOperation :permission="permission">
|
||||||
<el-button slot="right" class="filter-item" type="warning" icon="el-icon-s-promotion" size="mini" :disabled="audit_flag" @click="issueReturnBill">强制回传</el-button>
|
<el-button slot="right" class="filter-item" type="warning" icon="el-icon-s-promotion" size="mini" :disabled="audit_flag" @click="issueReturnBill">下发回传单</el-button>
|
||||||
|
<el-button slot="right" class="filter-item" type="primary" icon="el-icon-printer" size="mini" :disabled="audit_flag" @click="printBill">打印</el-button>
|
||||||
</crudOperation>
|
</crudOperation>
|
||||||
<el-table ref="table" v-loading="crud.loading" size="mini" :data="crud.data" highlight-current-row style="width: 100%;" @selection-change="crud.selectionChangeHandler" @current-change="handleCurrentChange" @select="handleSelectionChange">
|
<el-table ref="table" v-loading="crud.loading" size="mini" :data="crud.data" highlight-current-row style="width: 100%;" @selection-change="crud.selectionChangeHandler" @current-change="handleCurrentChange" @select="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="55" />
|
<el-table-column type="selection" width="55" />
|
||||||
@@ -47,6 +48,35 @@
|
|||||||
<el-table-column label="明细数" align="center" prop="dtl_count" width="80" />
|
<el-table-column label="明细数" align="center" prop="dtl_count" width="80" />
|
||||||
<el-table-column label="单据总数" align="center" prop="total_qty" width="80" />
|
<el-table-column label="单据总数" align="center" prop="total_qty" width="80" />
|
||||||
<el-table-column label="入库数量" align="center" prop="instock_qty" width="80" />
|
<el-table-column label="入库数量" align="center" prop="instock_qty" width="80" />
|
||||||
|
<el-table-column label="转发中鼎" align="center" prop="forwardZD" width="80">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<p v-if="scope.row.forwardZD == '0'">-</p>
|
||||||
|
<template v-else-if="scope.row.forwardZD == '1'">
|
||||||
|
<el-popconfirm
|
||||||
|
confirm-button-text='是'
|
||||||
|
cancel-button-text='否'
|
||||||
|
icon="el-icon-info"
|
||||||
|
icon-color="red"
|
||||||
|
title="是否重新转发中鼎?"
|
||||||
|
@confirm="toForwardZD"
|
||||||
|
>
|
||||||
|
<a slot="reference" style="color: red;text-decoration: underline">失败</a>
|
||||||
|
</el-popconfirm>
|
||||||
|
</template>
|
||||||
|
<!-- <a style="color: red;text-decoration: underline" v-else-if="scope.row.forwardZD == '1'">-->
|
||||||
|
<!-- <el-popconfirm-->
|
||||||
|
<!-- class="box-item"-->
|
||||||
|
<!-- title="是否重新转发?"-->
|
||||||
|
<!-- placement="top-start"-->
|
||||||
|
<!-- >-->
|
||||||
|
<!-- <template #reference>-->
|
||||||
|
<!-- 失败-->
|
||||||
|
<!-- </template>-->
|
||||||
|
<!-- </el-popconfirm>-->
|
||||||
|
<!-- </a>-->
|
||||||
|
<p v-else>成功</p>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column show-overflow-tooltip prop="supplier_code" width="120" label="供应商编码" />
|
<el-table-column show-overflow-tooltip prop="supplier_code" width="120" label="供应商编码" />
|
||||||
<el-table-column show-overflow-tooltip prop="supplier_name" width="150" label="供应商名称" />
|
<el-table-column show-overflow-tooltip prop="supplier_name" width="150" label="供应商名称" />
|
||||||
<el-table-column show-overflow-tooltip prop="creator" width="100" label="创建人" />
|
<el-table-column show-overflow-tooltip prop="creator" width="100" label="创建人" />
|
||||||
@@ -136,6 +166,9 @@ export default {
|
|||||||
const s = String(d.getSeconds()).padStart(2, '0')
|
const s = String(d.getSeconds()).padStart(2, '0')
|
||||||
return y + '-' + m + '-' + day + ' ' + h + ':' + min + ':' + s
|
return y + '-' + m + '-' + day + ' ' + h + ':' + min + ':' + s
|
||||||
},
|
},
|
||||||
|
toForwardZD(){
|
||||||
|
console.log(123)
|
||||||
|
},
|
||||||
toView(index, row) {
|
toView(index, row) {
|
||||||
this.mstrow = row
|
this.mstrow = row
|
||||||
this.viewShow = true
|
this.viewShow = true
|
||||||
@@ -182,6 +215,26 @@ export default {
|
|||||||
this.crud.notify('下发失败', CRUD.NOTIFICATION_TYPE.ERROR)
|
this.crud.notify('下发失败', CRUD.NOTIFICATION_TYPE.ERROR)
|
||||||
})
|
})
|
||||||
}).catch(() => {})
|
}).catch(() => {})
|
||||||
|
},
|
||||||
|
printBill() {
|
||||||
|
const selections = this.crud.selections
|
||||||
|
if (!selections || selections.length === 0) {
|
||||||
|
this.crud.notify('请至少选择一条单据', CRUD.NOTIFICATION_TYPE.INFO)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const ids = selections.map(s => s.id)
|
||||||
|
const billIds = selections.map(s => s.bill_id).join('、')
|
||||||
|
this.$confirm('确认打印以下单据的物料标签?\n' + billIds, '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
crudPurchase.print(ids).then(() => {
|
||||||
|
this.crud.notify('打印指令已发送', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||||
|
}).catch(() => {
|
||||||
|
this.crud.notify('打印失败', CRUD.NOTIFICATION_TYPE.ERROR)
|
||||||
|
})
|
||||||
|
}).catch(() => {})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,4 +39,12 @@ export function issueReturnBill(data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export default { add, edit, del, get, issueReturnBill }
|
export function print(ids) {
|
||||||
|
return request({
|
||||||
|
url: '/api/purchasemst/print',
|
||||||
|
method: 'post',
|
||||||
|
data: ids
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default { add, edit, del, get, issueReturnBill, print }
|
||||||
|
|||||||
@@ -34,3 +34,5 @@ CREATE TABLE IF NOT EXISTS `st_ivt_purchasedtl` (
|
|||||||
`instock_qty` DECIMAL(18,6) DEFAULT 0 COMMENT '已入库数量'
|
`instock_qty` DECIMAL(18,6) DEFAULT 0 COMMENT '已入库数量'
|
||||||
)COMMENT='采购入库单分录信息表';
|
)COMMENT='采购入库单分录信息表';
|
||||||
|
|
||||||
|
ALTER TABLE `wms_nlwq`.`st_ivt_purchasemst`
|
||||||
|
ADD COLUMN `forwardZD` tinyint(1) NULL DEFAULT 0 COMMENT '0否 1是' AFTER `audit_msg`;
|
||||||
Reference in New Issue
Block a user