using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Kingdee.BOS.ServiceInterface.ClientSDK;
using WindowsFormsApplication2.ServiceReference1;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
STK_InStock();
//MessageBox.Show(STK_InStock());
}
public void STK_InStock()
{
try
{
ServiceConfig.URL = @"http://localhost/K3CloudServiceInterface/";
var user = new KDUser()
{
AccountId = "565f92557a4d1f",
UserName = "demo",
Password = "888888"
};
using (var client = new KDServiceClient(user, ServiceConfig.URL))//执行到此处报错
{
STK_InStock_Save stk_save = new STK_InStock_Save();
stk_save.Model = new STK_InStock();
//单据类型
stk_save.Model.FBillTypeID = new STK_InStock_BOS_BillType() { FNumber = "RKD01_SYS" };
//单据编号
stk_save.Model.FBillNo = "CGRK00010";
//创建人
stk_save.Creator = "demo";
//入库日期
stk_save.Model.FDate = Convert.ToDateTime("2015/12/8"); ;
//单据状态
stk_save.Model.FDocumentStatus = "C";
//收料组织
stk_save.Model.FStockOrgId = new STK_InStock_ORG_Organizations() { FOrgID = 100003 };
//采购组织
stk_save.Model.FPurchaseOrgId = new STK_InStock_ORG_Organizations() { FOrgID = 100002 };
//供应商
stk_save.Model.FSupplierId = new STK_InStock_BD_Supplier() { FSupplierId = 100377 };
//结算方
stk_save.Model.FSettleId = new STK_InStock_BD_Supplier() { FSupplierId = 100377 };
//采购入库单明细
stk_save.Model.STK_InStock__FInStockEntry = new STK_InStock__FInStockEntry[] {
new STK_InStock__FInStockEntry(){
//物料编码
FMaterialId = new STK_InStock_BD_MATERIAL(){
FNumber="1.01.001.0070"
},
//货主类型
FOWNERTYPEID="BD_OwnerOrg",
//货主
FOWNERID= new STK_InStock_BOS_ItemClass{
FNumber="Y103"
},
FUnitID = new STK_InStock_BD_UNIT(){
FNumber="Pcs"
},
//仓库
FStockId= new STK_InStock_BD_STOCK(){
FNumber="Y10301"
},
//基本单位数量
FBaseUnitQty= 10,
//数量
FAuxUnitQty = 10,
FRealQty=10,
//单价
FPrice = 10,
//价税合计
FAmount = 100,
FIsReceiveUpdateStock=true }
};
var result = client.Send
//return result.Result.ResponseStatus.Message.ToString();
if (!result.Result.ResponseStatus.IsSuccess)
{
MessageBox.Show(result.Result.ResponseStatus.Message);
}
}
}
catch (Exception ex)
{
throw ex;
}
}
}
}