Commit a6836080 by cam

Set Status now works the same as the original program.

parent 1285e060
......@@ -3,8 +3,8 @@ object FAddOrder: TFAddOrder
Height = 477
OnShow = WebFormShow
object WebLabel1: TWebLabel
Left = 330
Top = 78
Left = 334
Top = 56
Width = 35
Height = 15
Caption = 'Search'
......@@ -12,8 +12,8 @@ object FAddOrder: TFAddOrder
WidthPercent = 100.000000000000000000
end
object WebLabel2: TWebLabel
Left = 478
Top = 78
Left = 482
Top = 56
Width = 58
Height = 15
Caption = 'Selected ID'
......@@ -21,8 +21,8 @@ object FAddOrder: TFAddOrder
WidthPercent = 100.000000000000000000
end
object edtSearch: TWebEdit
Left = 330
Top = 104
Left = 334
Top = 82
Width = 121
Height = 22
HeightPercent = 100.000000000000000000
......@@ -30,8 +30,8 @@ object FAddOrder: TFAddOrder
OnChange = edtSearchChange
end
object edtID: TWebEdit
Left = 478
Top = 104
Left = 482
Top = 82
Width = 69
Height = 22
ChildOrder = 1
......@@ -196,8 +196,8 @@ object FAddOrder: TFAddOrder
DesignTimeSampleData = True
end
object cbCorrugatedPlate: TWebCheckBox
Left = 0
Top = 105
Left = 4
Top = 83
Width = 113
Height = 22
Caption = 'Corrugated Plate'
......@@ -207,8 +207,8 @@ object FAddOrder: TFAddOrder
OnClick = cbCorrugatedPlateClick
end
object cbWebPlate: TWebCheckBox
Left = 124
Top = 105
Left = 128
Top = 83
Width = 83
Height = 22
Caption = 'Web Plate'
......@@ -218,8 +218,8 @@ object FAddOrder: TFAddOrder
OnClick = cbWebPlateClick
end
object btnCancel: TWebButton
Left = 676
Top = 103
Left = 680
Top = 81
Width = 96
Height = 25
Caption = 'Cancel'
......@@ -229,8 +229,8 @@ object FAddOrder: TFAddOrder
OnClick = btnCancelClick
end
object btnConfirm: TWebButton
Left = 560
Top = 103
Left = 564
Top = 81
Width = 96
Height = 25
Caption = 'Confirm'
......@@ -240,8 +240,8 @@ object FAddOrder: TFAddOrder
OnClick = btnConfirmClick
end
object cbCuttingDie: TWebCheckBox
Left = 227
Top = 105
Left = 231
Top = 83
Width = 83
Height = 22
Caption = 'Cutting Die'
......
......@@ -66,7 +66,7 @@ end;
procedure TFAddOrder.btnConfirmClick(Sender: TObject);
begin
if ( ( not cbCorrugatedPlate.Checked ) or ( not cbWebPlate.Checked ) or ( not cbCuttingDie.Checked ) ) then
if ( ( not cbCorrugatedPlate.Checked ) and ( not cbWebPlate.Checked ) and ( not cbCuttingDie.Checked ) ) then
edtNotification.Text := 'Please Select an Order Type'
else if edtID.Text = '' then
edtNotification.Text := 'Please Select a Customer'
......
......@@ -360,7 +360,7 @@ begin
if mode = 'EDIT' then
orderJSON.AddPair('ORDER_ID', orderID);
AddCorrugatedOrder(orderJSON);
FViewMain.ViewOrders('Success');
FViewMain.ViewOrders('Success:Order Successfully Added');
end;
procedure TFOrderEntryCorrugated.AddCorrugatedOrder(orderJSON: TJSONObject);
......
......@@ -83,7 +83,7 @@ type
procedure ShowSetStatusForm();
[async] procedure GetOrders(searchOptions: string);
[async] procedure GenerateReportPDF;
[async] procedure SetStatus(ORDER_ID, date, status: string);
[async] procedure SetStatus(statusInfo: string);
var
PageNumber: integer;
PageSize: integer;
......@@ -309,10 +309,8 @@ procedure TFViewOrders.ShowSetStatusForm();
// displays the search pop-up that allows the user to filter the order list
var
newform: TFSetStatus;
statusInfo: TJSONObject;
begin
newform := TFSetStatus.CreateNew;
statusInfo := TJSONObject.Create;
newform.Caption := 'Input Search Options';
newForm.Popup := True;
......@@ -331,23 +329,37 @@ begin
procedure(AValue: TModalResult)
var
searchOptions: string;
StatusJSON: TJSONObject;
begin
if newform.confirm then
begin
SetStatus(OrderID, DateTimeToStr(newform.dtpDate.Date), newform.wlcbStatus.Value);
getOrders(searchOptions);
StatusJSON := TJSONObject.Create;
StatusJSON.AddPair('ORDER_ID', OrderID);
StatusJSON.AddPair('date', DateTimeToStr(newform.dtpDate.Date));
StatusJSON.AddPair('status', newform.wlcbStatus.Value);
StatusJSON.AddPair('USER_ID', 1011);
StatusJSON.AddPair('mode', 'EDIT');
StatusJSON.AddPair('staff_fields_ship_date', DateToStr(newForm.dtpNewShipDue.Date));
StatusJSON.AddPair('staff_fields_mount_due', DateToStr(newForm.dtpNewMountDue.Date));
StatusJSON.AddPair('staff_fields_plate_due', DateToStr(newForm.dtpNewPlateDue.Date));
StatusJSON.AddPair('staff_fields_art_due', DateToStr(newForm.dtpNewArtDue.Date));
console.log(StatusJSON);
SetStatus(StatusJSON.ToString);
OrderID := '';
getOrders(GenerateSearchOptions());
end;
end
);
end;
procedure TFViewOrders.SetStatus(ORDER_ID, date, status: string);
procedure TFViewOrders.SetStatus(statusInfo: string);
var
xdcResponse: TXDataClientResponse;
statusOptions: string;
begin
statusOptions := '&ORDER_ID=' + ORDER_ID + '&date=' + date + '&status=' + status + '&USER_ID=1011';
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.SetStatus', [statusOptions]));
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.SetStatus', [statusInfo]));
end;
......@@ -710,7 +722,7 @@ begin
if orderID <> '' then
searchOptions := searchOptions + '&orderID=' + orderID;
console.log(searchOptions);
Result := searchOptions;
end;
......
......@@ -1005,26 +1005,30 @@ end;
function TLookupService.SetStatus(statusOptions: string): string;
var
params: TStringList;
OrderID: string;
StatusInfo: TJSONObject;
ORDER_ID: integer;
Date: String;
Status: string;
UserID: string;
SQL: string;
temp: string;
begin
try
logger.Log(1, 'Set Status Hit');
StatusInfo := TJSONObject.ParseJSONValue(statusOptions) as TJSONObject;
params := TStringList.Create;
// parse the statusOptions
params.Delimiter := '&';
params.StrictDelimiter := true;
params.DelimitedText := statusOptions;
OrderID := params.Values['ORDER_ID'];
Date := params.Values['date'];
Status := params.Values['status'];
UserID := params.Values['USER_ID'];
ORDER_ID := StatusInfo.GetValue<integer>('ORDER_ID');
Date := StatusInfo.GetValue<string>('date');
Status := StatusInfo.GetValue<string>('status');
UserID := StatusInfo.GetValue<string>('USER_ID');
SQL := 'select * from orders_status where ORDER_ID = ' + OrderID + ' AND ' +
SQL := 'select * from orders_status where ORDER_ID = ' + IntToStr(ORDER_ID) + ' AND ' +
'ORDER_STATUS = ' + quotedStr(Status);
try
logger.Log(1, 'Trying to Set Status');
doQuery(ordersDB.UniQuery1, SQL);
......@@ -1032,7 +1036,7 @@ begin
// Add Status
begin
ordersDB.UniQuery1.Insert;
ordersDB.UniQuery1.FieldByName('ORDER_ID').AsString := OrderID;
ordersDB.UniQuery1.FieldByName('ORDER_ID').AsString := IntToStr(ORDER_ID);
ordersDB.UniQuery1.FieldByName('ORDER_STATUS').AsString := Status;
ordersDB.UniQuery1.FieldByName('STATUS_DATE').AsDateTime := StrToDateTime(Date);
ordersDB.UniQuery1.FieldByName('STATUS_TIMESTAMP').AsDateTime := Now;
......@@ -1049,6 +1053,16 @@ begin
end;
ordersDB.UniQuery1.Post;
if StatusInfo.GetValue<string>('staff_fields_ship_date') <> '12/30/1899' then
AddStatusSchedule('SHIP', StatusInfo, ORDER_ID);
if StatusInfo.GetValue<string>('staff_fields_art_due') <> '12/30/1899' then
AddStatusSchedule('ART', StatusInfo, ORDER_ID);
if StatusInfo.GetValue<string>('staff_fields_plate_due') <> '12/30/1899' then
AddStatusSchedule('PLATE', StatusInfo, ORDER_ID);
if StatusInfo.GetValue<string>('staff_fields_mount_due') <> '12/30/1899' then
AddStatusSchedule('MOUNT', StatusInfo, ORDER_ID);
logger.Log(1, 'Status Successfully set');
result := 'success';
except
......
[Settings]
MemoLogLevel=4
FileLogLevel=5
LogFileNum=111
LogFileNum=123
webClientVersion=1.0.0
[Database]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment