|
|
@@ -14,6 +14,9 @@ import org.springframework.scheduling.annotation.EnableScheduling;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
@Component
|
|
|
@EnableAsync
|
|
|
@EnableScheduling
|
|
|
@@ -53,6 +56,42 @@ public class ProductTask {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Scheduled(cron = "0 0/10 * * * ?")
|
|
|
+ public void syncBannedProducts() {
|
|
|
+ SqlRowList rs = baseDao.queryForRowSet("select * from (select * from product where nvl(pr_statuscode,' ')='DISABLE' and nvl(pr_sfjszy_user,' ')<>'是' and nvl(pr_sendstatus,' ')='待上传' and 1=2 order by pr_id) where rownum<=200");
|
|
|
+ while (rs.next()){
|
|
|
+ Product product = setProduct(rs);
|
|
|
+ try {
|
|
|
+ BaseResult baseResult = productManager.invalidProduct(product.get_id());
|
|
|
+ int errorCode = baseResult.getErrorCode();
|
|
|
+ if(errorCode == 0){
|
|
|
+ baseDao.execute("insert into FXXKDockingErrorlog(ml_id,ml_date,ml_result,ml_type,ml_code) values(FXXKDOCKINGERRORLOG_SEQ.nextval,sysdate,'物料资料作废成功','物料资料作废','"+rs.getString("pr_code")+"')");
|
|
|
+ }else{
|
|
|
+ baseDao.execute("update product set pr_sendstatus='未上传成功' where pr_id="+rs.getInt("pr_id"));
|
|
|
+ baseDao.execute("insert into FXXKDockingErrorlog(ml_id,ml_date,ml_result,ml_type,ml_code) values(FXXKDOCKINGERRORLOG_SEQ.nextval,sysdate,'"+baseResult.getErrorMessage()+"','物料资料作废','"+rs.getString("pr_code")+"')");
|
|
|
+ logger.info("异常信息:"+baseResult.getErrorMessage());
|
|
|
+ }
|
|
|
+ List<String> idList = new ArrayList<>();
|
|
|
+ idList.add(product.get_id());
|
|
|
+ BaseResult baseResult_del = productManager.deleteProducts(idList);
|
|
|
+ int errorCode_del = baseResult_del.getErrorCode();
|
|
|
+ if(errorCode_del == 0){
|
|
|
+ baseDao.execute("update product set pr_sendstatus='已上传' where pr_id="+rs.getInt("pr_id"));
|
|
|
+ baseDao.execute("insert into FXXKDockingErrorlog(ml_id,ml_date,ml_result,ml_type,ml_code) values(FXXKDOCKINGERRORLOG_SEQ.nextval,sysdate,'物料资料删除成功','物料资料删除','"+rs.getString("pr_code")+"')");
|
|
|
+ }else{
|
|
|
+ baseDao.execute("update product set pr_sendstatus='未上传成功' where pr_id="+rs.getInt("pr_id"));
|
|
|
+ baseDao.execute("insert into FXXKDockingErrorlog(ml_id,ml_date,ml_result,ml_type,ml_code) values(FXXKDOCKINGERRORLOG_SEQ.nextval,sysdate,'"+baseResult_del.getErrorMessage()+"','物料资料删除','"+rs.getString("pr_code")+"')");
|
|
|
+ logger.info("异常信息:"+baseResult_del.getErrorMessage());
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ baseDao.execute("update product set pr_sendstatus='未上传成功' where pr_id="+rs.getInt("pr_id"));
|
|
|
+ baseDao.execute("insert into FXXKDockingErrorlog(ml_id,ml_date,ml_result,ml_type,ml_code) values(FXXKDOCKINGERRORLOG_SEQ.nextval,sysdate,'"+e.getMessage()+"','物料资料作废或删除','"+rs.getString("pr_code")+"')");
|
|
|
+ logger.info("异常信息:"+e.getMessage());
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Scheduled(cron = "0 0 23 * * ?")
|
|
|
public void syncUpdateProducts() {
|
|
|
SqlRowList rs = baseDao.queryForRowSet("select * from (select distinct pis_prodcode from productInfoSync where trunc(pis_date)=trunc(sysdate) and pis_updatedate is null) left join product on pis_prodcode=pr_code where nvl(pr_statuscode,' ')='AUDITED' and nvl(pr_sfjszy_user,' ')<>'是' order by pr_id");
|