20240311
This commit is contained in:
@@ -21,9 +21,14 @@ namespace EastChanger.STK_Inventory
|
||||
//同步海关信息
|
||||
if (e.BarItemKey.Equals("ImmediateInventory"))
|
||||
{
|
||||
opResult = new OperationResult();
|
||||
var list = this.ListView.SelectedRowsInfo;
|
||||
if (!list.Any())
|
||||
{
|
||||
this.View.ShowErrMessage("请选择需要同步的单据");
|
||||
return;
|
||||
}
|
||||
|
||||
opResult = new OperationResult();
|
||||
var fidList = list.Select(x => x.PrimaryKeyValue).Distinct().ToList();
|
||||
STKInventoryService service = new STKInventoryService(this.Context);
|
||||
service.HandleSyncData(fidList, opResult);
|
||||
|
||||
@@ -16,12 +16,15 @@ namespace EastChanger.STK_Inventory
|
||||
/// <summary>
|
||||
/// 即时库存明细
|
||||
/// </summary>
|
||||
public class STKInventoryService : BaseService
|
||||
public class STKInventoryService : BaseService, ISynchonService
|
||||
{
|
||||
public STKInventoryService(Context context) : base(context, "supvWarehouse.save", "即时库存明细")
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public string ModuleCnName => _moduleCnName;
|
||||
|
||||
/// <summary>
|
||||
/// 处理请求数据
|
||||
/// </summary>
|
||||
@@ -60,7 +63,7 @@ WHERE 1 = 1
|
||||
|
||||
var whereSql = "";
|
||||
if (idList != null && idList.Any())
|
||||
whereSql = string.Format(" AND t0.ID IN ({0}) ", string.Join("','", idList));
|
||||
whereSql = string.Format(" AND t0.ID IN ('{0}') ", string.Join("','", idList));
|
||||
var toSql = string.Format(headSql, whereSql);
|
||||
|
||||
List<Dictionary<string, object>> itemList = new List<Dictionary<string, object>>();
|
||||
@@ -105,7 +108,7 @@ WHERE 1 = 1
|
||||
main.Add("itemList", itemList);
|
||||
|
||||
var dataJson = JsonUtil.Serialize(main);
|
||||
var result = this.Execute(dataJson);
|
||||
var result = this.DoSubmit(dataJson);
|
||||
if (!result.IsNullOrEmpty())
|
||||
{
|
||||
JToken resData = JsonUtil.DeserializeObject<JToken>(result);
|
||||
@@ -118,7 +121,8 @@ WHERE 1 = 1
|
||||
|
||||
JArray rtnItemList = null;
|
||||
if (rtnFlag)
|
||||
rtnItemList = data["rtnObj"]["entity"]["itemList"] as JArray;
|
||||
//rtnItemList = data["rtnObj"]["entity"]["itemList"] as JArray;
|
||||
rtnItemList = data.SelectToken("rtnObj.entity.itemList") as JArray;
|
||||
|
||||
foreach (var kv in oIdList)
|
||||
{
|
||||
@@ -129,8 +133,8 @@ WHERE 1 = 1
|
||||
var index = kv.Value - 1;
|
||||
var rtnItem = rtnItemList[index];
|
||||
var rItemNo = rtnItem["itemNo"].ToString();
|
||||
var declaId = rtnItemList["declaId"].ToString();
|
||||
var syncId = rtnItemList["id"].ToString();
|
||||
var declaId = rtnItem["declaId"].ToString();
|
||||
var syncId = rtnItem["id"].ToString();
|
||||
//UpdateStkInventoryInfo(id, 1, itemNo, declaId, syncId);
|
||||
InserSyncRecord(id, 1, itemNo, declaId, syncId);
|
||||
}
|
||||
@@ -148,38 +152,6 @@ WHERE 1 = 1
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据账册分类后设置申报信息表头
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private Dictionary<string, Dictionary<string, object>> GetDeclInfos()
|
||||
{
|
||||
var newDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
var ledgerSql = @"SELECT * FROM V_LEDGER_INFO";
|
||||
|
||||
var ledgerInfos = DBUtils.ExecuteDynamicObject(_context, $"/*dialect*/{ledgerSql}");
|
||||
var groupList = ledgerInfos.GroupBy(x => x["FBOOKNUM"].ToString()).ToList();
|
||||
//var lInfo = ledgerInfos[0];
|
||||
var resultData = new Dictionary<string, Dictionary<string, object>>();
|
||||
foreach (var item in groupList)
|
||||
{
|
||||
var main = new Dictionary<string, object>();
|
||||
resultData.Add(item.Key, main);
|
||||
var lInfo = item.ToList()[0];
|
||||
main.Add("entCusCode", lInfo["FENTCUSCODE"]);
|
||||
main.Add("entCreditCode", lInfo["FENTCREDITCODE"]);
|
||||
main.Add("entName", lInfo["FENTNAME"]);
|
||||
main.Add("declaEntCusCode", lInfo["FDECLAENTCUSCODE"]);
|
||||
main.Add("declaEntCreditCode", lInfo["FDECLAENTCREDITCODE"]);
|
||||
main.Add("declaEntName", lInfo["FDECLAENTNAME"]);
|
||||
main.Add("customsCode", lInfo["FCUSTOMSCODE"]);
|
||||
main.Add("bookNum", lInfo["FBOOKNUM"]);
|
||||
}
|
||||
|
||||
return resultData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 同步完成后更新即时库存明细信息
|
||||
/// </summary>
|
||||
@@ -197,8 +169,11 @@ WHERE 1 = 1
|
||||
/// <summary>
|
||||
/// 同步完成后记录当前即时库存明细信息
|
||||
/// </summary>
|
||||
/// <param name="OId"></param>
|
||||
/// <param name="oId"></param>
|
||||
/// <param name="status"></param>
|
||||
/// <param name="itemNo"></param>
|
||||
/// <param name="declaId"></param>
|
||||
/// <param name="syncId"></param>
|
||||
private void InserSyncRecord(string oId, int status, string itemNo, string declaId, string syncId)
|
||||
{
|
||||
var newId = Guid.NewGuid();
|
||||
|
||||
Reference in New Issue
Block a user