|
|
@@ -6,12 +6,16 @@ import com.uas.mes.common.support.HandlerService;
|
|
|
import com.uas.mes.common.support.SystemSession;
|
|
|
import com.uas.mes.common.util.BaseUtil;
|
|
|
import com.uas.mes.core.data.SqlRowList;
|
|
|
+import com.uas.mes.core.util.CollectionUtil;
|
|
|
+import com.uas.mes.core.util.FlexJsonUtil;
|
|
|
import com.uas.mes.core.util.StringUtil;
|
|
|
import com.uas.mes.pm.service.MakeSNRuleMainService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@Service
|
|
|
@@ -70,7 +74,7 @@ public class MakeSNRuleMainServiceImpl implements MakeSNRuleMainService {
|
|
|
BaseUtil.showError("当前单据未关联生成镭雕条码,无需删除明细!");
|
|
|
}
|
|
|
baseDao.execute("delete from makesnruledetail where msd_mainid=?", id);
|
|
|
- baseDao.logger.others("删除所有条码明细", "删除有条码明细("+cn+"条)成功", caller, "mm_id", id);
|
|
|
+ baseDao.logger.others("删除所有条码明细", "工单:"+rs.getString("mm_macode")+",删除有条码明细("+cn+"条)成功", caller, "mm_id", id);
|
|
|
}else{
|
|
|
BaseUtil.showError("当前单据不存在或者已经删除!");
|
|
|
}
|
|
|
@@ -117,6 +121,48 @@ public class MakeSNRuleMainServiceImpl implements MakeSNRuleMainService {
|
|
|
*/
|
|
|
@Override
|
|
|
public void deleteSNRuleMain(int id, String caller) {
|
|
|
+ SqlRowList rs = baseDao.queryForRowSet("select mm_code,mm_macode from makesnrulemain where mm_id=?",id);
|
|
|
+ if(rs.next()) {
|
|
|
+ int cn = baseDao.getCount("select count(1) from makesnruledetail where msd_mainid=" + id);
|
|
|
+ if(cn == 0){
|
|
|
+ baseDao.execute("delete from makesnrulemain where mm_id=?", id);
|
|
|
+ baseDao.logger.delete(caller,"mm_id",id);
|
|
|
+ }else{
|
|
|
+ BaseUtil.showError("当前单据已经关联生成镭雕条码,请先清除所有条码明细再删除单据!");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ BaseUtil.showError("当前单据不存在或者已经删除!");
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * 批量删除序列号
|
|
|
+ * @param caller
|
|
|
+ * @param data
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void vastDeleteMakeSNDetail(String caller, String data) {
|
|
|
+ List<Map<Object, Object>> store = BaseUtil.parseGridStoreToMaps(data);
|
|
|
+ List<String> sqls = new ArrayList<String>();
|
|
|
+ if(!CollectionUtil.isEmpty(store)) {
|
|
|
+ String ids = CollectionUtil.pluckSqlString(store, "msd_id");
|
|
|
+ //判断是否被获取,是否确认
|
|
|
+ String err = baseDao.getJdbcTemplate().queryForObject("select wm_concat(msd_sncode) from makesnruledetail " +
|
|
|
+ " where msd_id in("+ids+") and nvl(MSD_ISGET,0)<>0 and rownum<20",String.class);
|
|
|
+ if(null != err ){
|
|
|
+ BaseUtil.showError("条码已经被镭雕接口获取不允许删除,条码号:"+err);
|
|
|
+ }
|
|
|
+ err = baseDao.getJdbcTemplate().queryForObject("select wm_concat(msd_sncode) from makesnruledetail " +
|
|
|
+ " where msd_id in("+ids+") and nvl(msd_status,0)<>0 and rownum<20",String.class);
|
|
|
+ if(null != err ){
|
|
|
+ BaseUtil.showError("条码已经被使用不允许删除,条码号:"+err);
|
|
|
+ }
|
|
|
+ //执行删除,记录日志
|
|
|
+ sqls.add("insert into messagelog(ml_date,ml_man,ml_content,ml_result,ml_search) " +
|
|
|
+ " select sysdate,'"+SystemSession.getUser().getEm_name()+"'," +
|
|
|
+ " '删除条码','删除成功,条码:'||msd_sncode||',工单:'||msd_makecode,'MakeSNRuleMain|mm_id='||MSD_MAINID from makesnruledetail where msd_id in("+ids+") and nvl(MSD_ISGET,0)=0 and nvl(msd_status,0)=0");
|
|
|
+ sqls.add("delete from makesnruledetail where msd_id in("+ids+") and nvl(MSD_ISGET,0)=0 and nvl(msd_status,0)=0");
|
|
|
+ baseDao.execute(sqls);
|
|
|
+ }
|
|
|
}
|
|
|
}
|