[BOS平台]开单贴,K/3Cloud系统集成配置及示例
https://vip.kingdee.com/article/15556
在线阅读该文档:
http://open.kingdee.com/K3cloud/WenKu/DocumentView.aspx?docId=108669
注:K/3 Cloud文档中心(wenku.ik3cloud.com)已正式上线,主要内容包括产品的培训文档(含视频)、安装包、竞争分析、售前方案、实施方案等。
1、补充物料保存案例:
[TestMethod]
public void Save_物料()
{
try
{
ServiceConfig.URL = @"http://localhost:48467/K3CloudServiceInterface/";
var user = new KDUser()
{
UserName = "Administrator",
Password = "888888"
};
using (var client = new KDServiceClient(user, ServiceConfig.URL))
{
BD_MATERIAL_Save save = new BD_MATERIAL_Save();
save.Model = new BD_MATERIAL();
//创建组织
save.Model.FCreateOrgId = new BD_MATERIAL_ORG_Organizations { FNUMBER = "100" };
//使用组织
save.Model.FUseOrgId = new BD_MATERIAL_ORG_Organizations { FNUMBER = "100" };
//编码
save.Model.FNumber = "kkklkl999ddd";
//物料名称
save.Model.FName = "原材ddd999ddd";
save.Model.BD_MATERIAL__SubHeadEntity = new BD_MATERIAL__SubHeadEntity();
// 存货类别,必填
save.Model.BD_MATERIAL__SubHeadEntity.FCategoryID = new BD_MATERIAL_BD_MATERIALCATEGORY();
save.Model.BD_MATERIAL__SubHeadEntity.FCategoryID.FNumber = "CHLB01_SYS";
var ret = client.Send
}
}
catch (WebServiceException ex)
{
throw ex;
}
}
2、补充上传附件案例:
和单据不一样的是,附件这个单据默认是在系统中没有开放的,因此需要先在设计器中发布附件到K/3Cloud主控台,然后在表单服务中定义附件的保存服务。其他的就和单据、基础资料一样的。
[TestMethod]
public void Save_附件()
{
try
{
ServiceConfig.URL = @"http://localhost:48467/K3CloudServiceInterface/";
var user = new KDUser()
{
UserName = "Administrator",
Password = "888888"
};
using (var client = new KDServiceClient(user, ServiceConfig.URL))
{
BOS_Attachment_Save save = new BOS_Attachment_Save();
save.Model = new BOS_Attachment();
save.Model.FInterID = "100031";//单据内码
save.Model.FEntryInterID = "-1";// 不是单据体分录附件,需要设置-1
save.Model.FBillType = "ENG_SHIFTSLICE";//单据类型,;示例为班次的元数据标识
save.Model.FBillNo = "BC000001";//单据编号
string filePath = @"C:\Users\rd_ben_liu\Desktop\Cloud.txt";//文件路径
using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read))
{
BinaryReader br = new BinaryReader(fs);
save.Model.FAttachment = br.ReadBytes((int)fs.Length);// 附件内容
save.Model.FAttachmentName = fs.Name.Substring(fs.Name.LastIndexOf('\\') + 1);
save.Model.FAttachmentSize = Convert.ToString(Math.Round((Decimal)fs.Length / 1024, 2));
save.Model.FExtName = fs.Name.Substring(fs.Name.LastIndexOf('.'));
}
var ret = client.Send
}
}
catch (WebServiceException ex)
{
throw ex;
}
}
3、补充收料单示例代码
[TestMethod()]
public void Save收料单()
{
try
{
ServiceConfig.URL = @"http://localhost:48467/K3CloudServiceInterface/";
var user = new KDUser()
{
AccountId = "",
UserName = "Administrator",
Password = "888888"
};
using (var client = new KDServiceClient(user, ServiceConfig.URL))
{
PUR_ReceiveBill_Save bill = new PUR_ReceiveBill_Save();
bill.Model = new PUR_ReceiveBill();
bill.Model.FDemandOrgId = new PUR_ReceiveBill_ORG_Organizations();
bill.Model.FDemandOrgId.FNUMBER = "100";
bill.Model.FStockOrgId = new PUR_ReceiveBill_ORG_Organizations() { FNUMBER ="100" };
bill.Model.FPurOrgId = new PUR_ReceiveBill_ORG_Organizations() { FNUMBER = "100" };
bill.Model.FCorrespondOrgId = new PUR_ReceiveBill_ORG_Organizations() { FNUMBER = "100" };
bill.Model.FSupplierId = new PUR_ReceiveBill_BD_Supplier() { FNUMBER = "VEN00002" };
bill.Model.FOwnerIdHead = new PUR_ReceiveBill_BOS_ItemClass() { FNumber = "VEN00002" };
bill.Model.FBillTypeID = new PUR_ReceiveBill_BOS_BillType();
bill.Model.FBillTypeID.FNumber = "SLD01_SYS";
bill.Model.PUR_ReceiveBill__FinanceEntity = new PUR_ReceiveBill__FinanceEntity();
bill.Model.PUR_ReceiveBill__FinanceEntity.FSettleOrgId = new PUR_ReceiveBill_ORG_Organizations() { FNUMBER="200"};
bill.Model.PUR_ReceiveBill__FinanceEntity.FSettleCurrId = new PUR_ReceiveBill_BD_Currency() { FNumber = "PRE001" };
List
//// 收料单分录行1
PUR_ReceiveBill__FDetailEntity entry = new PUR_ReceiveBill__FDetailEntity();
entry.FMaterialId = new PUR_ReceiveBill_BD_MATERIAL();
entry.FMaterialId.FNumber = "10100001";
entry.FUnitId = new PUR_ReceiveBill_BD_UNIT();
entry.FUnitId.FNumber = "0031";
entry.FActlandQty = 1000;
entry.FActReceiveQty = 1000;
entry.FBaseUnitQty = 1000;
entry.FStockID = new PUR_ReceiveBill_BD_STOCK() { FNumber = "YZWH017" }; //= new PUR_ReceiveBill_BD_NEWSTAFF() { FStaffNumber = "YZWH017" };
entry.FStockStatusId = new PUR_ReceiveBill_BD_StockStatus();
entry.FStockStatusId.FNumber = "KCZT01_SYS";
entry.FIsReceiveUpdateStock = true;
list.Add(entry);
//// 表体赋值
bill.Model.PUR_ReceiveBill__FDetailEntity = list.ToArray();
//// 其他参数
//bill.Parameters = "如果服务操作插件需要接受其他参数,可以在这里传入";
var ret = client.Send
}
}
catch (WebServiceException ex)
{
throw ex;
}
}
SIBetaTest.zip(25.86KB)
K3 Cloud V2.0 BOS 技术开发培训_系统集成. …(1.78MB)
K3 Cloud V2.0 BOS 技术开发培训_系统集成. …(1.78MB)
SIBetaTest.zip(25.86KB)
推荐阅读