2
This commit is contained in:
@@ -65,6 +65,7 @@
|
||||
<Compile Include="BaseService.cs" />
|
||||
<Compile Include="CustomsSyncVaildators.cs" />
|
||||
<Compile Include="Entites\BaseRequest.cs" />
|
||||
<Compile Include="Entites\Entities2GroupBy.cs" />
|
||||
<Compile Include="ISynchonService.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="sfj4Class.cs" />
|
||||
@@ -85,6 +86,7 @@
|
||||
<Content Include="SQLServer\1.账册信息视图.sql" />
|
||||
<Content Include="SQLServer\2.1.库存明细同步接口回填.sql" />
|
||||
<Content Include="SQLServer\2.明细信息关联视图.sql" />
|
||||
<Content Include="SQLServer\3.其他入库单.sql" />
|
||||
<Content Include="SQLServer\5.盘盈单_表体.sql" />
|
||||
<Content Include="SQLServer\5.盘盈单_表头.sql" />
|
||||
<Content Include="SQLServer\6.盘亏单_表体.sql" />
|
||||
|
||||
15
08.昶东/EastChanger/Entites/Entities2GroupBy.cs
Normal file
15
08.昶东/EastChanger/Entites/Entities2GroupBy.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace EastChanger.Entites
|
||||
{
|
||||
public class Entities2GroupBy
|
||||
{
|
||||
//public int Id { get; set; }
|
||||
public string BillNo { get; set; }
|
||||
|
||||
public bool SyncStatus { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ namespace EastChanger
|
||||
/// </summary>
|
||||
/// <param name="idList"></param>
|
||||
/// <param name="opResult"></param>
|
||||
/// <param name="action">1.删除</param>
|
||||
/// <param name="action">1.删除 2.变更</param>
|
||||
void HandleSyncData(List<string> idList, IOperationResult opResult, int action);
|
||||
}
|
||||
}
|
||||
|
||||
45
08.昶东/EastChanger/SQLServer/3.其他入库单.sql
Normal file
45
08.昶东/EastChanger/SQLServer/3.其他入库单.sql
Normal file
@@ -0,0 +1,45 @@
|
||||
IF EXISTS(SELECT * FROM sysobjects WHERE name = 'V_SYNC_STKMiscellaneous')--单引号里面为视图名称
|
||||
DROP VIEW V_SYNC_STKMiscellaneous--视图名称
|
||||
GO
|
||||
CREATE VIEW V_SYNC_STKMiscellaneous AS
|
||||
SELECT
|
||||
t0.FID
|
||||
,t0.FBILLNO
|
||||
--,t1.FDECLAENTCREDITCODE
|
||||
--,t1.FDECLAENTCUSCODE
|
||||
--,t1.FDECLAENTNAME
|
||||
--,t1.FENTCREDITCODE
|
||||
--,t1.FENTCUSCODE
|
||||
--,t1.FENTNAME
|
||||
,t1e.FID AS LEDGERID
|
||||
,t1e.FENTRYID AS BookNumId
|
||||
,t1e.FBOOKNUM
|
||||
,t1e.FCUSTOMSCODE
|
||||
,t0.FDATE
|
||||
,t0.FSTATUS AS SyncStatus
|
||||
,t0e.FSEQ
|
||||
,'QTRK' AS storageType
|
||||
,t0e.FINSTOCKDATE
|
||||
,t2.FNUMBER AS materialCd
|
||||
,t2_l.FNAME AS materialDesc
|
||||
,t0e.FQTY AS storageCnt
|
||||
,t3.FNUMBER AS calcUnit
|
||||
,t0e.FHSCODE AS hscode
|
||||
,t0e.FINVENTORY as inventory
|
||||
,t0e.FINVENTORYORDERNO as inventoryOrderNo
|
||||
,t4.FNUMBER as warehouseCd
|
||||
,t5.FNUMBER as warehousePosiCd
|
||||
,'' AS bookSn
|
||||
,ROW_NUMBER() OVER(PARTITION BY t0e.FID,t1e.FENTRYID ORDER BY t0e.FSEQ ASC) AS itemNo
|
||||
FROM T_STK_MISCELLANEOUS t0
|
||||
INNER JOIN T_STK_MISCELLANEOUSENTRY t0e on t0.FID = t0e.FID
|
||||
INNER JOIN T_BD_LEDGERSTOCK t1es on t1es.FLEDGERSTOCKID = t0e.FSTOCKID
|
||||
INNER JOIN T_BD_LEDGERENTRY t1e on t1e.FENTRYID = t1es.FENTRYID
|
||||
--INNER JOIN T_BD_LEDGER t1 on t1.FID = t1e.FID
|
||||
INNER JOIN T_BD_MATERIAL t2 on t2.FMATERIALID = t0e.FMATERIALID
|
||||
INNER JOIN T_BD_MATERIAL_L t2_l on t2_l.FMATERIALID = t2.FMATERIALID AND t2_l.FLOCALEID = 2052
|
||||
INNER JOIN T_BD_UNIT t3 on t3.FUNITID = t0e.FUNITID
|
||||
INNER JOIN T_BD_STOCK t4 on t4.FSTOCKID = t0e.FSTOCKID
|
||||
LEFT JOIN T_BAS_FLEXVALUESDETAIL t6 on t6.FID = t0e.FSTOCKID
|
||||
LEFT JOIN T_BAS_FLEXVALUESENTRY t5 ON t5.FENTRYID = t6.FF100001 OR t5.FENTRYID = t6.FF100002
|
||||
WHERE t0.FDOCUMENTSTATUS = 'C' AND t1.FDOCUMENTSTATUS = 'C'
|
||||
@@ -1,5 +1,10 @@
|
||||
using Kingdee.BOS;
|
||||
using EastChanger.Entites;
|
||||
using ExtensionMethods;
|
||||
using Kingdee.BOS;
|
||||
using Kingdee.BOS.App.Data;
|
||||
using Kingdee.BOS.Core.DynamicForm;
|
||||
using Kingdee.BOS.Util;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -20,7 +25,122 @@ namespace EastChanger.STK_Miscellaneous
|
||||
|
||||
public void HandleSyncData(List<string> idList, IOperationResult opResult, int action)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var declInfos = GetDeclInfos();
|
||||
var headSql = $@"
|
||||
SELECT
|
||||
rowSet.resVal AS ID
|
||||
INTO #TMPMATERIALNUM
|
||||
FROM (
|
||||
SELECT CAST('<v>'+ REPLACE('{string.Join(",", idList)}',',','</v><v>') + '</v>' AS XML) AS xmlVal
|
||||
) AS valSet
|
||||
OUTER APPLY (
|
||||
SELECT T.C.value('.','varchar(100)') resVal
|
||||
FROM valSet.xmlVal.nodes('/v') AS T(C)
|
||||
) rowSet
|
||||
|
||||
SELECT t1.ID EntityId,t2.FBILLNO AS EntityBillNo,t0.*
|
||||
FROM (SELECT t0.* FROM V_SYNC_STKMiscellaneous t0 WHERE 1 = 1 {{0}}) t0
|
||||
RIGHT JOIN #TMPMATERIALNUM t1 on t0.FID = t1.FID
|
||||
INNER JOIN T_STK_MISCELLANEOUS t2 on t2.FID = t1.FID
|
||||
";
|
||||
|
||||
var whereSql = "";
|
||||
if (action == 0)
|
||||
whereSql = " AND t0.SyncStatus != '-1' AND t0.SyncStatus != 1 ";
|
||||
else
|
||||
whereSql = " AND (t0.SyncStatus IN('-1','1')) ";
|
||||
|
||||
var toSql = string.Format(headSql, whereSql);
|
||||
//var toSql = headSql + whereSql;
|
||||
var dbList = DBUtils.ExecuteDynamicObject(_context, $"/*dialect*/{toSql}");
|
||||
if (dbList != null && dbList.Any())
|
||||
{
|
||||
var gbList = dbList.GroupBy(x => new Entities2GroupBy { BillNo = x["EntityBillNo"].ToString(), SyncStatus = x["FID"].Long2Int() > 0 });
|
||||
foreach (var bill in gbList)
|
||||
{
|
||||
|
||||
if (bill.Key.SyncStatus)
|
||||
ExecuteOperateResult(opResult, bill.Key.BillNo, "单据不符合同步条件,请检查单据状态", false);
|
||||
|
||||
var billNo = bill.Key.BillNo;
|
||||
var sort = 0;
|
||||
Dictionary<string, object> main = null;
|
||||
List<Dictionary<string, object>> itemList = new List<Dictionary<string, object>>();
|
||||
foreach (var entity in bill)
|
||||
{
|
||||
if (sort == 0)
|
||||
{
|
||||
var bookNum = entity["FBOOKNUM"].ToSafeTurnString();
|
||||
var syncStatus = entity["SyncStatus"].Long2Int();
|
||||
|
||||
//申报类型
|
||||
var declaType = "";
|
||||
if (action == 1)
|
||||
declaType = "99";
|
||||
else if (action == 2)
|
||||
declaType = "01";
|
||||
else
|
||||
declaType = "00";
|
||||
|
||||
main = new Dictionary<string, object>(declInfos[bookNum]);
|
||||
main.Add("declaCode", entity["FBILLNO"].ToSafeTurnString());
|
||||
main.Add("storageTm", entity["FINSTOCKDATE"].ToSafeTurnString());
|
||||
main.Add("storageType", entity["storageType"].ToSafeTurnString());
|
||||
main.Add("inputMan", entity["inputMan"].ToSafeTurnString());
|
||||
main.Add("busiType", "03");
|
||||
main.Add("declaType", declaType);
|
||||
main.Add("inputDate", entity["FDATE"].ToString());
|
||||
main.Add("declaDate", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
||||
main.Add("itemList", itemList);
|
||||
sort++;
|
||||
}
|
||||
|
||||
var item = new Dictionary<string, object>();
|
||||
item.Add("itemNo", entity["itemNo"].ToString());
|
||||
item.Add("storageOrderNo", entity["itemNo"].ToString());
|
||||
item.Add("materialCd", entity["materialCd"].ToSafeTurnString());
|
||||
item.Add("materialDesc", entity["materialDesc"].ToSafeTurnString());
|
||||
item.Add("storageCnt", entity["storageCnt"].ToSafeTurnString());
|
||||
item.Add("calcUnit", entity["calcUnit"].ToSafeTurnString());
|
||||
item.Add("hscode", entity["hscode"].ToSafeTurnString());
|
||||
item.Add("inventory", entity["inventory"].ToSafeTurnString());
|
||||
item.Add("inventoryOrderNo", entity["inventoryOrderNo"].ToSafeTurnString());
|
||||
item.Add("warehouseCd", entity["warehouseCd"].ToSafeTurnString());
|
||||
item.Add("warehousePosiCd", entity["warehousePosiCd"].ToSafeTurnString());
|
||||
item.Add("bookSn", entity["bookSn"].ToSafeTurnString());
|
||||
itemList.Add(item);
|
||||
|
||||
}
|
||||
|
||||
var dataJson = JsonUtil.Serialize(main);
|
||||
var result = this.DoSubmit(dataJson);
|
||||
|
||||
if (!result.IsNullOrEmpty())
|
||||
{
|
||||
JToken resData = JsonUtil.DeserializeObject<JToken>(result);
|
||||
var code = resData["code"].Long2Int();
|
||||
if (code == 0)
|
||||
{
|
||||
var data = resData["data"];
|
||||
var rtnFlag = data["rtnFlag"].Long2Int() == 0;
|
||||
var rtnMessage = data["rtnMessage"].ToString();
|
||||
UpdateStatus(this._context, billNo, rtnFlag ? "1" : (action == 0 ? "-2" : "-1"));
|
||||
ExecuteOperateResult(opResult, billNo, rtnMessage, rtnFlag);
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateStatus(this._context, billNo, action == 0 ? "-2" : "-1");
|
||||
ExecuteOperateResult(opResult, billNo, resData["msg"].ToString(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateStatus(Context context, string id, string status)
|
||||
{
|
||||
var headSql = @"UPDATE T_STK_MISCELLANEOUS set FSTATUS=" + status + " where FID = " + id;
|
||||
DBUtils.ExecuteDynamicObject(context, $"/*dialect*/{headSql}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,12 +66,13 @@ WHERE 1 = 1
|
||||
|
||||
if (headList != null && headList.Any())
|
||||
{
|
||||
var groupList = entryList.GroupBy(x => x["ID"].ToString());
|
||||
var groupList = entryList.GroupBy(x => x["ID"].Long2Int());
|
||||
|
||||
foreach (var head in headList)
|
||||
{
|
||||
var itemList = new List<Dictionary<string, object>>();
|
||||
var id = head["ID"].ToSafeTurnString();
|
||||
var billNo = head["FBILLNO"].ToSafeTurnString();
|
||||
var id = head["ID"].Long2Int();
|
||||
var bookNum = head["FBOOKNUM"].ToSafeTurnString();
|
||||
var syncStatus = head["SyncStatus"].Long2Int();
|
||||
|
||||
@@ -85,7 +86,7 @@ WHERE 1 = 1
|
||||
//申报通用表头信息
|
||||
#region 表头信息
|
||||
var main = new Dictionary<string, object>(declInfos[bookNum]);
|
||||
main.Add("declaCode", id);
|
||||
main.Add("declaCode", billNo);
|
||||
main.Add("inventoryDt", head["inventoryDt"].ToSafeTurnString());
|
||||
main.Add("inputMan", head["inputMan"].ToSafeTurnString());
|
||||
main.Add("declaType", declaType);
|
||||
@@ -133,12 +134,12 @@ WHERE 1 = 1
|
||||
var rtnFlag = data["rtnFlag"].Long2Int() == 0;
|
||||
var rtnMessage = data["rtnMessage"].ToString();
|
||||
UpdateStatus(this._context, id, (rtnFlag ? "1" : "-1"));
|
||||
ExecuteOperateResult(opResult, id, rtnMessage, rtnFlag);
|
||||
ExecuteOperateResult(opResult, billNo, rtnMessage, rtnFlag);
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateStatus(this._context, id, "-1");
|
||||
ExecuteOperateResult(opResult, id, resData["msg"].ToString(), false);
|
||||
ExecuteOperateResult(opResult, billNo, resData["msg"].ToString(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -151,7 +152,7 @@ WHERE 1 = 1
|
||||
/// <param name="context"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="status"></param>
|
||||
public void UpdateStatus(Context context, string id, string status)
|
||||
public void UpdateStatus(Context context, long id, string status)
|
||||
{
|
||||
var headSql = $@"UPDATE T_STK_STKCOUNTGAIN set FSTATUS='{status}' where FID = " + id;
|
||||
DBUtils.ExecuteDynamicObject(context, $"/*dialect*/{headSql}");
|
||||
|
||||
@@ -52,12 +52,13 @@ WHERE 1 = 1
|
||||
|
||||
if (headList != null && headList.Any())
|
||||
{
|
||||
var groupList = entryList.GroupBy(x => x["ID"].ToString());
|
||||
var groupList = entryList.GroupBy(x => x["ID"].Long2Int());
|
||||
|
||||
foreach (var head in headList)
|
||||
{
|
||||
var itemList = new List<Dictionary<string, object>>();
|
||||
var id = head["ID"].ToSafeTurnString();
|
||||
var id = head["ID"].Long2Int();
|
||||
var billNo = head["FBILLNO"].ToSafeTurnString();
|
||||
var bookNum = head["FBOOKNUM"].ToSafeTurnString();
|
||||
var syncStatus = head["SyncStatus"].Long2Int();
|
||||
|
||||
@@ -119,12 +120,12 @@ WHERE 1 = 1
|
||||
var rtnFlag = data["rtnFlag"].Long2Int() == 0;
|
||||
var rtnMessage = data["rtnMessage"].ToString();
|
||||
UpdateStatus(this._context, id, (rtnFlag ? "1" : "-1"));
|
||||
ExecuteOperateResult(opResult, id, rtnMessage, rtnFlag);
|
||||
ExecuteOperateResult(opResult, billNo, rtnMessage, rtnFlag);
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateStatus(this._context, id, "-1");
|
||||
ExecuteOperateResult(opResult, id, resData["msg"].ToString(), false);
|
||||
ExecuteOperateResult(opResult, billNo, resData["msg"].ToString(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -137,7 +138,7 @@ WHERE 1 = 1
|
||||
/// <param name="context"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="status"></param>
|
||||
public void UpdateStatus(Context context, string id, string status)
|
||||
public void UpdateStatus(Context context, long id, string status)
|
||||
{
|
||||
var headSql = $@"UPDATE T_STK_STKCOUNTGAIN set FSTATUS='{status}' where FID = " + id;
|
||||
DBUtils.ExecuteDynamicObject(context, $"/*dialect*/{headSql}");
|
||||
|
||||
Reference in New Issue
Block a user