/// <summary> /// 入库日期校验 /// </summary> /// <param name="date"></param> /// <param name="linkData"></param> private string dateValitor(DateTime date, DynamicObjectCollection linkData) { string billNo = ""; string sql = string.Format("select FDATE,FBILLNO from T_PUR_Receive where FID in ({0})", string.Join(",", linkData.Select(s => Convert.ToInt32(s["SBillId"])))); DynamicObjectCollection reData = DBUtils.ExecuteDynamicObject(this.Context, sql); if (reData.Any(a => date < Convert.ToDateTime(a["FDATE"]))) { billNo = Convert.ToString(reData.FirstOrDefault(f => date < Convert.ToDateTime(f["FDATE"]))["FBILLNO"]); } //foreach (DynamicObject item in linkData) //{ // int receiveId = Convert.ToInt32(item["SBillId"]); // if (item["sTableName"].ToString() != "T_PUR_ReceiveEntry") continue;//跳过非收料单下推 // string sql = string.Format("select FDATE,FBILLNO from T_PUR_Receive where FID={0}", receiveId); // DynamicObjectCollection reData = DBUtils.ExecuteDynamicObject(this.Context, sql); // if (reData == null || reData.Count == 0) continue; // DateTime receiveDate = Convert.ToDateTime(reData[0]["FDATE"]); // if (date < receiveDate) // { // billNo = reData[0]["FBILLNO"].ToString(); // break; // } //} return(billNo); }