|
|
@@ -66,15 +66,18 @@ public class SampleApplyTask {
|
|
|
MAUser = (MA_USER == null || "".equals(MA_USER.toString()))?"YJH_T":MA_USER.toString();
|
|
|
}
|
|
|
}
|
|
|
- if(baseDao.checkIf(MAUser+".ProdInOutApply", "pi_code='" + name + "'") || i==2){
|
|
|
+ if(baseDao.checkIf(MAUser+".ProdInOutApply", "pi_code='" + name + "'")){
|
|
|
baseDao.execute("insert into FXXKDockingErrorlog(ml_id,ml_date,ml_result,ml_type,ml_code) values(FXXKDOCKINGERRORLOG_SEQ.nextval,sysdate,'样品申请编号已存在','样品申请主表下载','"+name+"')");
|
|
|
logger.info("异常信息:样品申请编号已存在");
|
|
|
n++;
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- Object cu_code = baseDao.getFieldDataByCondition("customer", "max(cu_code) cu_code", "CU_FXXKID='" + dataList.get(i).get("field_l6W5b__c") + "'");
|
|
|
+ Object cu_code = baseDao.getFieldDataByCondition("customer", "max(cu_code) cu_code", "CU_FXXKID='" + dataList.get(i).get("field_l6W5b__c") + "' or cu_name='"+dataList.get(i).get("field_l6W5b__c__r")+"'");
|
|
|
String cuCode =cu_code == null ? "" : cu_code.toString();
|
|
|
+ //默认样品仓
|
|
|
+ Object wh_description = baseDao.getFieldDataByCondition("Warehouse", "max(wh_description) wh_description", "wh_code='W02'");
|
|
|
+ String pi_whname =wh_description == null ? "" : wh_description.toString();
|
|
|
|
|
|
Object life_status = dataList.get(i).get("life_status");
|
|
|
Object record_type = dataList.get(i).get("record_type");
|
|
|
@@ -96,10 +99,10 @@ public class SampleApplyTask {
|
|
|
Long last_modified_time = Long.parseLong(new BigDecimal(dataList.get(i).get("last_modified_time").toString()).toPlainString());
|
|
|
//客户联系人:pi_purposename 电话:pi_expresscode
|
|
|
int pi_id = baseDao.getSeqId(MAUser+".PRODINOUTAPPLY_SEQ");
|
|
|
- String sql="insert into "+MAUser+".ProdInOutApply(pi_id,pi_code,pi_class,pi_date,pi_status,pi_statuscode,pi_cardcode,pi_title,pi_emcode,pi_emname,pi_recordman,pi_recorddate," +
|
|
|
+ String sql="insert into "+MAUser+".ProdInOutApply(pi_id,pi_code,pi_class,pi_date,pi_status,pi_statuscode,pi_whcode,pi_whname,pi_cardcode,pi_title,pi_emcode,pi_emname,pi_recordman,pi_recorddate," +
|
|
|
"pi_updateman,pi_updatedate,pi_purposename,pi_expresscode,pi_address,pi_field_Il1e1,pi_record_type,pi_life_status,PI_FXXKID)" +
|
|
|
"values("+pi_id+",'"+name+"','其它出库申请单',"+DateUtil.parseDateToOracleString(Constant.YMD_HMS,sdf.parse(sdf.format(field_lp4Q1__c)))+"," +
|
|
|
- "'在录入','ENTERING','"+cuCode+"','"+dataList.get(i).get("field_l6W5b__c__r")+"','"+owner_code+"','"+owner__r.get("name")+"','"+ created_by__r.get("name")+"'," +
|
|
|
+ "'已审核','AUDITED','W02','"+pi_whname+"','"+cuCode+"','"+dataList.get(i).get("field_l6W5b__c__r")+"','"+owner_code+"','"+owner__r.get("name")+"','"+ created_by__r.get("name")+"'," +
|
|
|
DateUtil.parseDateToOracleString(Constant.YMD_HMS,sdf.parse(sdf.format(create_time)))+",'"+last_modified_by__r.get("name")+"',"+
|
|
|
DateUtil.parseDateToOracleString(Constant.YMD_HMS,sdf.parse(sdf.format(last_modified_time)))+",'" +dataList.get(i).get("field_DzO73__c__r")+"',"+
|
|
|
"'"+dataList.get(i).get("field_57196__c")+"','"+(dataList.get(i).get("field_6OcTn__c")==null?"":dataList.get(i).get("field_6OcTn__c"))+"','"+dataList.get(i).get("field_Il1e1__c")+"','"+recordType+"','"+lifeStatus+"','"+_id+"')";
|
|
|
@@ -136,6 +139,9 @@ public class SampleApplyTask {
|
|
|
if(errorCode == 0){
|
|
|
Map<String, Object> data = crmQueryResult.getData();
|
|
|
List<Map<String, Object>> dataList = (List<Map<String,Object>>) data.get("dataList");
|
|
|
+ //默认样品仓
|
|
|
+ Object wh_description = baseDao.getFieldDataByCondition("Warehouse", "max(wh_description) wh_description", "wh_code='W02'");
|
|
|
+ String pi_whname =wh_description == null ? "" : wh_description.toString();
|
|
|
//m:成功条数 n:失败条数
|
|
|
int m=0,n=0;
|
|
|
if(dataList.size()>0){
|
|
|
@@ -157,8 +163,8 @@ public class SampleApplyTask {
|
|
|
Object owner_code = baseDao.getFieldDataByCondition(MAUser+".employee", "max(em_code) em_code", "em_name='" + owner__r.get("name") + "'");
|
|
|
|
|
|
//客户联系人:pi_purposename 电话:pi_expresscode
|
|
|
- String sql="insert into "+MAUser+".ProdIOApplyDetail(pd_id,pd_piid,pd_pdno,pd_code,pd_piclass,pd_picode,pd_ownercode,pd_owner,pd_prodcode,pd_detail,pd_sepc,pd_brand,pd_outqty,YPonhand,PD_FXXKID)" +
|
|
|
- "values("+MAUser+".PRODIOAPPLYDETAIL_SEQ.nextval,"+pi_id+","+(i+1)+",'"+name+"','其它出库申请单','"+dataList.get(i).get("field_8019j__c__r")+"'," +
|
|
|
+ String sql="insert into "+MAUser+".ProdIOApplyDetail(pd_id,pd_piid,pd_pdno,pd_code,pd_piclass,pd_whcode,pd_whname,pd_picode,pd_ownercode,pd_owner,pd_prodcode,pd_detail,pd_sepc,pd_brand,pd_outqty,YPonhand,PD_FXXKID)" +
|
|
|
+ "values("+MAUser+".PRODIOAPPLYDETAIL_SEQ.nextval,"+pi_id+","+(i+1)+",'"+name+"','其它出库申请单','W02','"+pi_whname+"','"+dataList.get(i).get("field_8019j__c__r")+"'," +
|
|
|
"'"+owner_code+"','"+owner__r.get("name")+"','"+ (dataList.get(i).get("field_2Lq6Y__c")==null?"":dataList.get(i).get("field_2Lq6Y__c")) +"','"+(dataList.get(i).get(" field_utezf__c__r")==null?"":dataList.get(i).get(" field_utezf__c__r"))+"'," +
|
|
|
"'"+(dataList.get(i).get("field_21Suz__c")==null?"":dataList.get(i).get("field_21Suz__c"))+"','"+(dataList.get(i).get("field_y5dz2__c")==null?"":dataList.get(i).get("field_y5dz2__c"))+"','" +dataList.get(i).get("field_7uspZ__c")+"',"+
|
|
|
"'"+dataList.get(i).get("field_lzxe2__c")+"','"+_id+"')";
|