-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMvxSckCommand.cs
More file actions
364 lines (352 loc) · 9.43 KB
/
MvxSckCommand.cs
File metadata and controls
364 lines (352 loc) · 9.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
/*
*
* MvxLib, an open source C# library used for communication with Intentia Movex.
* http://mvxlib.sourceforge.net
*
* Copyright (C) 2005 - 2007 Mattias Bengtsson
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
using System;
namespace MvxLib
{
public class MvxSckCommand
{
#region Prices
public static string GetPrice(
int company,
string division,
string warehouse,
string item,
int quantity,
string customer,
string ordertype,
string currency,
string pricelist,
string discount_model,
DateTime date,
string unit_of_measure
)
{
MvxSckCommandBuilder cb = new MvxSckCommandBuilder("GetPrice");
cb.Add(company, 3);
cb.Add(division, 3);
cb.Add(warehouse, 3);
cb.Add(item, 15);
cb.Add(quantity, 16);
cb.Add(customer, 10);
cb.Add(ordertype, 3);
cb.Add(currency, 3);
cb.Add(pricelist, 2);
cb.Add(discount_model, 10);
cb.Add(date);
cb.Add(unit_of_measure, 3);
return cb.Command;
}
public static string GetPrice(
int company,
string warehouse,
string item,
int quantity,
string customer,
string ordertype,
string currency,
string pricelist,
DateTime date,
string unit_of_measure
)
{
return GetPrice(
company,
string.Empty,
warehouse,
item,
quantity,
customer,
ordertype,
currency,
pricelist,
string.Empty,
date,
unit_of_measure);
}
public static string GetPriceLine(
int company,
string facility,
string customer,
string item,
string warehouse,
DateTime date,
int quantity,
string unit_of_measure,
string currency,
string ordertype,
string pricelist
)
{
MvxSckCommandBuilder cb = new MvxSckCommandBuilder("GetPriceLine");
cb.Add(company, 3);
cb.Add(facility, 3);
cb.Add(customer, 10);
cb.Add(item, 15);
cb.Add(warehouse, 3);
cb.Add(date);
cb.Add(quantity, 16);
cb.Add(unit_of_measure, 3);
cb.Add(currency, 3);
cb.Add(ordertype, 3);
cb.Add(pricelist, 2);
return cb.Command;
}
#endregion
#region Orders
public static string AddBatchHead(
int company,
string customer_no,
string language,
string order_type,
DateTime requested_delivery,
string facility,
string customer_order_no,
string agent,
string salesman,
string delivery_method,
string delivery_term,
string customer_reference,
string project,
string order_discount_amount,
string payment_terms,
string payer,
string delivery_address,
string currency,
string our_reference,
string goods_mark
)
{
MvxSckCommandBuilder cb = new MvxSckCommandBuilder("AddBatchHead");
cb.Add(company, 3);
cb.Add(customer_no, 10);
cb.Add(language, 2);
cb.Add(order_type, 3);
if (requested_delivery == DateTime.MinValue)
cb.Add(string.Empty, 10);
else
cb.Add(requested_delivery);
cb.Add(facility, 3);
cb.Add(customer_order_no, 20);
cb.Add(agent, 10);
cb.Add(salesman, 4);
cb.Add(delivery_method, 3);
cb.Add(delivery_term, 3);
cb.Add(customer_reference, 30);
cb.Add(project, 6);
cb.Add(order_discount_amount, 16);
cb.Add(payment_terms, 3);
cb.Add(payer, 10);
cb.Add(delivery_address, 6);
cb.Add(currency, 3);
cb.Add(our_reference, 30);
/*
// According to documentation
cb.Add(string.Empty, 10); // quotation_no
cb.Add(string.Empty, 36); // delivery_terms
// According to MRS001
cb.Add(string.Empty, 107); // filler
cb.Add(string.Empty, 3); // contact_method
*/
// Workaround
cb.Add(string.Empty, 292); // unknown param(s)
cb.Add(goods_mark, 30);
return cb.Command;
}
public static string AddBatchText(
int company,
string temp_order_no,
int text_location,
int order_line,
int text_type,
string document_class,
string text
)
{
MvxSckCommandBuilder cb = new MvxSckCommandBuilder("AddBatchText");
cb.Add(company, 3);
cb.Add(temp_order_no, 7);
cb.Add(text_location, 1);
cb.Add(order_line, 3);
cb.Add(string.Empty, 2); // line suffix
cb.Add(text_type, 1);
cb.Add(document_class, 4);
cb.Add(text, 240);
return cb.Command;
}
public static string AddBatchAddress(
int company,
string temp_order_no,
int address_type,
string address_id,
string customer_name,
string address_line1,
string address_line2,
string address_line3,
string address_line4,
string postal_code,
string country_code
)
{
MvxSckCommandBuilder cb = new MvxSckCommandBuilder("AddBatchAddress");
cb.Add(company, 3);
cb.Add(temp_order_no, 7);
cb.Add(address_type, 2);
cb.Add(address_id, 6);
cb.Add(customer_name, 36);
cb.Add(address_line1, 36);
cb.Add(address_line2, 36);
cb.Add(address_line3, 36);
cb.Add(address_line4, 36);
cb.Add(postal_code, 10);
cb.Add(string.Empty, 10); // phone no
cb.Add(string.Empty, 10); // fax no
cb.Add(country_code, 3);
cb.Add(string.Empty, 16); // vat
cb.Add(string.Empty, 3); // place of load
cb.Add(string.Empty, 6); // route
cb.Add(string.Empty, 3); // route departure
cb.Add(string.Empty, 5); // unloading zone
cb.Add(string.Empty, 3); // tax code
cb.Add(string.Empty, 2); // area/state
cb.Add(string.Empty, 6); // harbor or airport
cb.Add(string.Empty, 30); // your reference 1
return cb.Command;
}
public static string AddBatchLine(
int company,
string temp_order_no,
string item_no,
double quantity,
string warehouse,
DateTime requested_delivery,
string delivery_code,
string customer_order_no,
double sales_price,
bool sales_price_empty,
string delivery_specification,
string delivery_specification_text,
string configuration_no,
string unit,
DateTime confirmed_delivery,
string item_description
)
{
MvxSckCommandBuilder cb = new MvxSckCommandBuilder("AddBatchLine");
cb.Add(company, 3);
cb.Add(temp_order_no, 7);
cb.Add(item_no, 15);
cb.Add(quantity, 16);
cb.Add(warehouse, 3);
if (requested_delivery == DateTime.MinValue)
cb.Add(string.Empty, 10);
else
cb.Add(requested_delivery);
cb.Add(delivery_code, 3);
cb.Add(customer_order_no, 7);
if (sales_price_empty)
cb.Add(string.Empty, 18);
else
cb.Add(sales_price, 18);
cb.Add(string.Empty, 16); // discount amount 1
cb.Add(string.Empty, 16); // discount amount 2
cb.Add(string.Empty, 16); // discount amount 3
cb.Add(string.Empty, 16); // discount amount 4
cb.Add(string.Empty, 16); // discount amount 5
cb.Add(string.Empty, 16); // discount amount 6
cb.Add(delivery_specification, 12);
cb.Add(delivery_specification_text, 36);
cb.Add(configuration_no, 7);
cb.Add(string.Empty, 3); // simulation no
cb.Add(unit, 3);
if (confirmed_delivery == DateTime.MinValue)
cb.Add(string.Empty, 10);
else
cb.Add(confirmed_delivery);
cb.Add(item_description, 30);
return cb.Command;
}
public static string AddBatchHeadChg(
int company,
string temp_order_no,
string charge,
double charge_amount,
double recalc_factor,
string description
)
{
MvxSckCommandBuilder cb = new MvxSckCommandBuilder("AddBatchHeadChg");
cb.Add(company, 3);
cb.Add(temp_order_no, 10);
cb.Add(charge, 6);
cb.Add(charge_amount, 16);
cb.Add(recalc_factor, 12);
cb.Add(description, 30);
return cb.Command;
}
public static string AddBatchLineChg(
int company,
string temp_order_no,
int line_no,
int line_suffix,
string charge,
double charge_amount,
double recalc_factor,
string description
)
{
MvxSckCommandBuilder cb = new MvxSckCommandBuilder("AddBatchLineChg");
cb.Add(company, 3);
cb.Add(temp_order_no, 10);
cb.Add(line_no, 3);
cb.Add(line_suffix, 2);
cb.Add(charge, 6);
cb.Add(charge_amount, 16);
cb.Add(recalc_factor, 12);
cb.Add(description, 30);
return cb.Command;
}
public static string Confirm(
int company,
string temp_order_no,
string confirmation_type
)
{
MvxSckCommandBuilder cb = new MvxSckCommandBuilder("Confirm");
cb.Add(company, 3);
cb.Add(temp_order_no, 7);
cb.Add(confirmation_type, 1);
return cb.Command;
}
public static string GetLastOrderErrorMessage(
int company,
string temporary_order_number
)
{
MvxSckCommandBuilder cb = new MvxSckCommandBuilder("LstErrMsgOrder");
cb.Add(company, 3);
cb.Add(temporary_order_number, 7);
return cb.Command;
}
#endregion
}
}