package com.zy.asrs.task.handler;
|
|
import com.zy.asrs.task.AbstractHandler;
|
import com.zy.asrs.task.core.ReturnT;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.stereotype.Service;
|
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
/**
|
* Created by vincent on 2020/7/7
|
*/
|
@Service
|
public class NotifyLogHandler extends AbstractHandler<String> {
|
|
private static final String WAIT_PAKIN_ARCHIVE_COLUMNS =
|
"zpallet, anfme, loc_no, matnr, maktx, batch, order_no, specs, model, color, brand, unit, price, sku, units, barcode, " +
|
"origin, manu, manu_date, item_num, safe_qty, weight, man_length, volume, three_code, supp, supp_code, be_batch, dead_time, " +
|
"dead_warn, source, inspect, danger, status, io_status, modi_time, modi_user, appe_time, appe_user, memo, standby1, standby2, " +
|
"standby3, box_type1, box_type2, box_type3";
|
|
private static final String ARCHIVE_FINISHED_WAIT_PAKIN_SQL =
|
"insert into cust_wait_pakin_log (" + WAIT_PAKIN_ARCHIVE_COLUMNS + ") " +
|
"select " + WAIT_PAKIN_ARCHIVE_COLUMNS + " from cust_wait_pakin where io_status = 'F'";
|
|
@Autowired
|
private JdbcTemplate jdbcTemplate;
|
|
@Transactional
|
public ReturnT<String> start() {
|
try {
|
// 入库通知档转历史档
|
int pakInLog = jdbcTemplate.update(ARCHIVE_FINISHED_WAIT_PAKIN_SQL);
|
if (pakInLog > 0) {
|
int pakInDelete = jdbcTemplate.update("delete from cust_wait_pakin where io_status = 'F';");
|
if (pakInDelete <= 0) {
|
exceptionHandle("入库通知档转历史档失败");
|
}
|
}
|
// todo:luxiaotao
|
// 出库通知档转历史档
|
|
// 盘点通知档转历史档
|
|
} catch (Exception e) {
|
e.printStackTrace();
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
return FAIL.setMsg(e.getMessage());
|
}
|
return SUCCESS;
|
}
|
|
}
|