using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using FireBirdUtil.SqlUtils;
|
|
using Forks.JsonRpc.Client;
|
|
using Forks.JsonRpc.Client.Data;
|
|
using WeighBusiness.BO;
|
|
using WeighBusiness.Utils;
|
|
using WeighBusiness.Utils.SqlUtils;
|
|
using System.Configuration;
|
|
|
|
namespace WeighBusiness.BL
|
|
{
|
|
public static class ProduceBatch_RoadMap_RefBL
|
|
{
|
|
public static bool Insert(ProduceBatch_RoadMap_Ref pr)
|
|
{
|
|
string insertSql = InsertUtil.GetInsertSql(TableNames.已完毕路线,
|
|
new string[] { "ProduceBatch_ID", "RoadMap_ID"},
|
|
new string[] { pr.ProduceBatch_ID.ToString(),pr.RoadMap_ID.ToString()});
|
|
return ExcuteSql(insertSql);
|
|
}
|
|
|
|
private static bool ExcuteSql(string sql)
|
|
{
|
|
bool success;
|
|
using (var she = new SqlHelperEx()) {
|
|
she.CreateTransaction();
|
|
she.ExecuteNonQuery(sql, out success);
|
|
if (!success)
|
|
she.Rollback();
|
|
else
|
|
she.Commit();
|
|
}
|
|
return success;
|
|
}
|
|
|
|
public static void Delete()
|
|
{
|
|
var sql = SqlUtil.GetDeleteSql(TableNames.已完毕路线);
|
|
using (var she = new SqlHelperEx()) {
|
|
bool success;
|
|
she.CreateTransaction();
|
|
she.ExecuteNonQuery(sql, out success);
|
|
if (!success)
|
|
she.Rollback();
|
|
else
|
|
she.Commit();
|
|
}
|
|
}
|
|
|
|
public static void SyncProduceBatch_RoadMap_Ref()
|
|
{
|
|
var domain_ID = ConfigurationManager.AppSettings["Food_Domain_ID"];
|
|
var accountingUnit_ID = ConfigurationManager.AppSettings["Food_AccountingUnit_ID"];
|
|
if (domain_ID != null && !string.IsNullOrEmpty(domain_ID.ToString()) && accountingUnit_ID != null && !string.IsNullOrEmpty(accountingUnit_ID.ToString())) {
|
|
ProduceBatch_RoadMap_RefBL.Delete();
|
|
var method = "/MainSystem/B3_HaoYue/Rpcs/RpcFun/GetProduceBatch_RoadMap_Ref";
|
|
var list = RpcFacade.Call<List<RpcObject>>(method, long.Parse(domain_ID.ToString()), long.Parse(accountingUnit_ID.ToString()));
|
|
if (list.Count > 0) {
|
|
foreach (var detail in list) {
|
|
var prr = new ProduceBatch_RoadMap_Ref();
|
|
prr.ProduceBatch_ID = detail.Get<long>("ProduceBatch_ID");
|
|
prr.RoadMap_ID = detail.Get<long>("RoadMap_ID");
|
|
ProduceBatch_RoadMap_RefBL.Insert(prr);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|