|
|
@@ -13,12 +13,14 @@ public class GetFirstDeliveryDateService extends ServiceController {
|
|
|
ArrayList<String> sqlList = new ArrayList<>();
|
|
|
for (Row siterow : siterows) {
|
|
|
String siteid = siterow.getString("siteid");
|
|
|
- Rows stockbillrows = dbConnect.runSqlQuery("select sys_enterpriseid,min(checkdate) checkdate from st_stockbill where type='销售出库' and status='审核' and siteid='"+siteid+"' and sys_enterpriseid in(select sys_enterpriseid from sa_agents where ifnull(startdate,'')='') group by sys_enterpriseid");
|
|
|
- if(!stockbillrows.isEmpty()) {
|
|
|
+ Rows stockbillrows = dbConnect.runSqlQuery("select sys_enterpriseid,min(checkdate) checkdate from st_stockbill where type='销售出库' and status='审核' and checkdate is not null and siteid='" + siteid + "' and sys_enterpriseid in(select sys_enterpriseid from sa_agents where ifnull(startdate,'')='') group by sys_enterpriseid");
|
|
|
+ if (!stockbillrows.isEmpty()) {
|
|
|
for (Row stockbillrow : stockbillrows) {
|
|
|
long sys_enterpriseid = stockbillrow.getLong("sys_enterpriseid");
|
|
|
- sqlList.add("update sa_agents set startdate='"+stockbillrow.getString("checkdate")+"' where sys_enterpriseid="+sys_enterpriseid);
|
|
|
- //System.err.println("update sat_campaign set status='结束' where sat_campaignid="+sat_campaignid);
|
|
|
+ String checkdate = stockbillrow.getString("checkdate");
|
|
|
+ if (!checkdate.isEmpty()) {
|
|
|
+ sqlList.add("update sa_agents set startdate='" + stockbillrow.getString("checkdate") + "' where sys_enterpriseid=" + sys_enterpriseid);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|